I know this has been asked many times but somehow I am not able to get over this error. Here is my directory structure-
project/
pkg/
__init__.py
subpackage1/
script1.py
__init__.py
subpackage2/
script2.py
__init__.py
script2.py has:
class myclass:
def myfunction:
script1.py has
from ..subpackage2 import script2
I also tried
from ..subpackage2 import myclass
And this gives me : ValueError: Attempted relative import in non-package
Any help would be really appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…