I have a structure like this:
package/ __init__.py subpackage1/ __init__.py baseclass.py subpackageA/ __init__.py ClassA.py subpackageB/ __init__.py ClassB.py
in package/__init__.py and package/subpackage1/__init__.py I am importing the subpackages so that in my app I can just call
instead of having to import each subpackage individually
Here is package/subpackage1/__init__.py for example
from baseclass import BaseClass import subpackageA import subpackageB
I run into a problem where in classA or classB I create a class that tries to inherit from BaseClass, which is of located higher in the hierarchy.
class ClassA(package.subpackage1.BaseClass): pass
It gives me
exceptions.AttributesError: 'module' object has no attribute 'subpackage1'
Although I see no reason why subpackage1 wouldn't be defined yet, BaseClass is even imported before it tries to import subpackageA, I'm guessing this is still some sort of circular reference thing though.
This seems like something that would be a common thing to want to do. Any help would be appreciated, thanks!