I get the module not found error when importing my self made module.
Structure:
environment (folder/module to import)
project (folder)
-- project_scripts (folder)
-- main_script.py
The problem is that I can run the main_script.py file from my text editor (pycharm) but not from the command line, then it gives the moduleNotFound error: no module named environment. Which is something I want to realize: running from the terminal.
The weird thing is that Pycharm gives type hints for the module, so it seems to recognize it. I am using an anaconda environment, but I made sure to activate it (in the terminal) and have set it as the Pycharm interpreter.
Details: Python 3.8.16 The module has a init file
I hope someone could help me in the right direction, as I have been struggling more than 1 times with importing self-made modules to Python files, and struggled to find a consistent method.
I feel like it might have something to do with PYTHONPATH but im unsure as I don't have too much knowledge about this.
I tried different methods, such as changing the cwd to a different place (thought it would find the module in a different area) but that didn't seem to work.