I'm having some issues importing modules.
The project structure is something like:
xpr01
---- xpr02
---- __init__.py
---- folder01
---- app_helpers.py
---- data_manipulation.py
---- folder02
---- main.py
In order to run main.py (which is in folder02), I need some functions defined in the modules contained in folder01.
So, when using PyCharm I set xpr01 as working directory, and in main.py I'm using:
from xpr02.folder01.data_manipulation import get_policies, get_categories, get_country_data
from xpr02.folder01.data_manipulation import get_plan_df, get_all_plans_df
And everything works just fine. However, when I try running it from terminal (Ubuntu 18.04), I get the error:
ModuleNotFoundError: No module named 'xpr02'
I assume the issue is that I should do...something which has the same effect as specifying the working directory in PyCharm. I was assuming having the init.py under xpr02 would do it, but apparently I'm wrong.
EDIT
PyCharm is executing the command:
/home/my_home_folder/anaconda3/envs/myenv/bin/python /home/my_home_folder/projects/xpr01/xpr02/folder02/main.py
While I was simply running:
python main.py
from within folder02. I tried running the same command as in PyCharm (with all the absolute paths), but I'm still getting the same error.