Circular (or cyclic) imports in Python
What will happen if two modules import each other?
What will happen if two modules import each other?
So I’m getting this error
Let’s say I have the following directory structure:
EDIT: The ImportError and AttributeError issues only occur in
python 2. In python 3 the import machinery has been rewritten and all
of these import statements (with the exception of 4) will work, even with
circular dependencies. While the solutions in this section may help refactoring python 3 code, they are mainly intended
for people using python 2.
I have two files, node.py and path.py, which define two classes, Node and Path, respectively.