I wanted to reach for a python module outside of my current working directory of my script - *test.py*,
theproject
├── one_folder
│ ├── main.py
│ └── src
│ ├── test.py
└── another_folder_in_root
├── moduleiwant.py
I point to the path from the root folder of project
I go:
from another_folder_in_root.moduleiwant import functioniwant
The root folder of the project is in PYTHONPATH, as follows: (I use PyCharm btw.)
['/Users/me/PycharmProjects/theproject/one_folder', ...,
'/Users/me/PycharmProjects/theproject'
So the root dir of the project is in fact in the pythonpath!
But that doesn't work!
However, if I add the root folder of the project directly to sys.path
, it suddenly works. Can you tell me why? This is ridiculous...