0

So I am trying to access to a file contained inside a folder which himself is inside the parent folder :

_PARENT
   - __init__.py
   - Parser
      - __init__.py
      - myPars.py
   - Getter
      - __init__.py
      - getSomething.py
   - Setter
      - __init__.py
      - setSomething.py

What I need here is to access to 'myPars' from the 'getSomething'. I tried this :

from ..Parser import myPars

But I get :

ImportError: attempted relative import with no known parent package

Any help would be appreciated, Thanks.

Serinkan
  • 53
  • 1
  • 8

1 Answers1

0

I just found the answer, all I needed was to add the folder to the path like :

pth = os.path.abspath(os.getcwd())
sys.path.insert(0, pth)
Serinkan
  • 53
  • 1
  • 8