i have the following directory structure
project
example
module
file1.py
__init__.py
test
module
test1.py
__init__.py
i need to reuse the code in test1.py
in file1.py i am importing the module as
from test.module.test1 import MyClass
The code is working for me when i run in PyCharm since the content root is set. In case of terminal, i am able to run the example only when i set the PYTHONPATH to "/home/ubuntu/project" . i.e. my project folder.
If the path is not set am getting the following error
ModuleNotFoundError: No module named 'test.module'
The code is failing in CI. i dont have the control of setting up the PYTHONPATH before running file1.py.
Is there any way to fix it with python in file1.py (by setting some path).
I couldnt move the test code to a common place, since it is referenced in many placed.