So this problem took already so much time in my life that I would really much would like to solve this once and for all. I changed the directories in my project and now everything is broken again, so what is the best way to solve this? My structure is like this:
MYPROJECT|-- src | -- data __init__.py basic_script.py -- utils __init__.py some_utils.pybasic_script.py needs some functions from some_utils.py. I import these with
'import utils.some_utils as some_utilsThe root in my terminal is 'c:\some_path\MYPROJECT.I run the file with
'python src/data/basic_script.py'Now I had everything working , but I changed the root directory and now I get the error:
ModuleNotFoundError: No module named 'utils'So i can try to solve this over the coming hours, but I would like to know how to avoid this in the future:
- what exactly do I have to add to my python path?
- is this the way to solve this, or can it be done in a better way?
- If I transfer the whole project to a different system, what is the way to make it work again? Can this be done with a setup.py? If yes, how exactly?
My sys.path currently only contains all python versions and 'c:\projects\MYPROJECT\.venv'
thanks!