1. In every parent class, import each child with :
from childfilename import childclassname
For example, in the optionwindow class, you will have :
from mainwindowfilename import mainwindowclassname
from toolbarfilename import toolbarsclassname
from menubarfilename import menubarclassname
Note 1 : For better lisibility, name your files with the same name as your classes.
*for example : mytoolbar.py contains class mytoolbar(QtGui.QToolBar)*
Note 2 : You need to place an empty __init__.py in every folder that contains a class)
Note 3 : You can place classes in different folders. If you do so, use :
from folder.childfilename import childclassname
2. To instantiate and call child functions or get child variables :
In the parent class :
self.child1=childclassname()
self.child1.childfunction1()
a1 = self.child1.childvariable1
In the child class :
...
self.childvariable1 = 2
def childfunction1(self):
...
3. To get parent or grand-parents variables or functions in child :
In the parent class :
...
self.parentvariable1 = 2
def parentfunction1(self):
...
In the child class :
self.parent().parentfunction1()`
a1 = self.parent().parentvariable1`
Note : self.parent().parent(). ... will get you to the grand parent.
I hope it helped