I am trying to import a class from parent directory to my script but I receive attempted relative import with no known parent package
error, I have searched everywhere in the internet but still cannot fix the error. Here is my package structure:
A/
a.py
__init__.py
B/
__init__.py
c.py
Now assume I have class1 inside a.py
module and I am trying to import it in the c.py
module. I have tried:
from ..A.a import class1
But i get above error message I have tried to add the A folder to sys.path
but still the same error. Can anyone explain how I can import a package from a function or class from parent directory to subdirectory (like from a.py
to c.py
)