I did some research and tried to apply it but failed. I have a project structured like so using python 3.10:
└── project
├── main
│ └── main.py
└── pkg1
└── module.py
module.py and main.py are nothing fancy:
#module1.py
def hello():
print('hello')
yet in main.py all imports fail (obviously i call only one of the 3).
#main.py
from pkg1.module import hello
from .pkg1.module import hello
from ..pkg1.module import hello
hello()
For any of the tried imports I get:
ImportError: attempted relative import with no known parent package
How do I import the module? And yes, I have to keep the file/folder structure as is because of constraints.