I can't seem to figure out how to fix the error below when trying to import a file from one directory up and it's making me crazy. Python 3.6.7.
Here's how The Internet says it should be done, one directory up:
from .. import app
Here's the error:
Traceback (most recent call last):
  File "module1.py", line 16, in <module>
    from .. import app
ValueError: attempted relative import beyond top-level package
Here's the dir structure (It should be noted that I'm calling the script module1.py from inside package1):
--- project/
    --- __init__.py
    --- app.py
    --- package1/
        --- __init__.py
        --- module1.py
Here's what I've tried to fix it:
Method 1 (same error)
import sys
HERE = Path(__file__).parent
sys.path.append(str(HERE / '../'))
from .. import app
Method 2 (found here, same error)
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__)))
from .. import app
Method 3 ( also found here, same error)
import sys
sys.path.append('.')
from .. import app
 
     
    