I am building a gui using HasTraits objects. I have a main object, and then objects for each component of the gui. I would like to share an object across multiple components. For example, i have a main window A which has components B and C. C needs to have access to things in B. currently i am doing this
class B(HasTraits):
...
class C(HasTraits):
...
class A(HasTraits):
b = Instance(B,())
c = Instance(C)
...
def _c_default(self):
return C(b = self.b,...)
...
Which seems like not the best way to do this. Also there are sub-sub-components so A.C.D, and D needs things in A.B.
Is this the best way to share objects using traits?