How to link dynamic objects

I made a dynamic component of a door and it works : if I click on it the door opens onClick 0, 45 and 90 degrees , represented by a custom attribute called DoorOpening
I also made a dynamic hinge and that works too : if I click on it the hinge opens onClick 0,45 and 90 dagrees., represented by a custom attribute calels HingeOpening

Now I want to put a hinge on the wall (doorpost) and the door.
How can I link the attribute HingeOpening to Dooropening?
Without that the door opens but the hinge doesn’t.

Any way to achieve my goal in another way?
I’m using Sketchup 2016

How about putting the leaf of the hinge that would be attached to the door into the door component?

Yoyr suggestion is a possibility but it requires to do so for EVERY hinge I use.
Especially after sinzing you have to check if both parts of each hinge still are in the right position.

And I think there will be other cases where it would be very useful if you can refer to an attribute (i.e. position) of another object, something like X=Get(‘X’)
Does this type of action exist?

You can reference an attribute in another component using the ! operator. For example

X: =OtherComponent!lenX

It works parent to child, child to parent, and between sibling components. In Fact there is a special name called Parent just for the case of referencing the parents attributes.

X: =Parent!LenX

But there is no model-wide database of DCs and no way to reference one that isn’t in the same nesting hierarchy

Speaking of,… this whole thread was about how to set up the DC nesting for a swinging door assembly:

How to make dynamic Component children inherit the onClick message - #5 by DanRathbun

The OP in that thread, wanted to setup a hinge component, and then insert various door and jamb components into the hinge component thereby “giving” the door the ability to swing. But it not that simple. The jamb stays till, as well as the half the hinge leaves, and I suppose the hinge pins as well.