Here's the structure of my project:
MyProject
|
|---- package1
| |
| |---- classA needs classXYZ
| |-----classB needs classXYZ
| |-----classC
|
|-----package2
| |
| |-----classXYZ (path creator)
|
|-----package3
| |
| |-----classQ (subclass of classR)
| |-----classR
|
|-----package4
| |
| |-----classDB needs classXYZ
ClassQ
needs classA
, classB
, classR
, classDB
and classXYZ
, So, in classQ
I have:
from package1 import classA
from package1 import classB
from package2 import classXYZ
from package3 import classR
from package4 import classDB
However, both class classA
and classB
use classXYZ
which results in fact that in classQ
I'm getting the error: Import Error: no module named classR.
(Class Q inherits from class R).
The question is: how to solve this? Class Q is some kind of main class, which uses functions available in other modules to make a working application. Any help will be appreciated.