Here are my two folder structures:
A/B/C/D/E/F.py
A/B/C/G/H/I/test.py
My test.py wants to import the class of F.py. I have set the root directory to C. I tried:
from C.D.F import FClassname
This is not working. The message is
ImportError: No module named C.D.F
I have ensure that all the directories have __init__.py files. I don't want to add any code to test.py. I want to add code in the __init__.py so that it applies to all the future test files that I'll write.
In the __init__.py of the directory H, I have written the follwing code:
import os
import sys
root = os.path.realpath(os.path.join(os.path.dirname(__file__), '../../'))
sys.path.append(root)
Where am I going wrong?
 
    