For some reason, I am unable to import a certain file. Here is my directory structure:
root_folder/
program_to_run.py
configuration/
..config files
tools/
__init__.py
tools_to_use1/
__init__.py
dependencies/
__init__.py
helper_1.py
... other .py files
unit_tests/
_init__.py
helper_1_test.py
... other unit tests for dependencies
tools_to_use2/
__init__.py
hardware/
__init__.py
helper_2.py
... other .py files
... other .py files
Where I am trying to import helper_2.py
into helper_1.py
In helper_1.py I have the following import statement:
from tools_to_use2.hardware import helper_2.py
However, when I use helper_1.py
in program_to_run.py
(in the root folder) I get the following error:
ModuleNotFoundError: No module named 'tools_to_use2'
I'm assuming that it has to do with the way I am packaging my scripts? I followed the structure here: https://docs.python.org/3/tutorial/modules.html (6.4 Packages) However, I am not sure what I am doing wrong. Thanks to all of those who reply in advance.
I have also tried adding the module to my PYTHON PATH, and I am still having not luck. I have also tried doing the sys.insert trick, but even that is not working for me.