I am using python 3.8.11 and following is my project structure
test-project
|
|--- package_1
| |
| |-- module_11.py
|
|--- package_2
|
|-- module_21.py
I have following snippets inside the modules
# test-project/package_1/module_11.py
def my_func_11():
print("Hello from module_11.")
# test-project/package_2/module_21.py
from package_1 import module_11
module_11.my_func_11()
When I execute module_21.py while in test-project directory it works perfectly fine on Linux (RHEL 7.9) but same project throws ModuleNotFoundError
on Windows.
Tried adding __init__.py
and importing respective package modules in both directories package_1 and package_2.
I know this can be fixed by adding project path to sys.path but I am more concerned about why it does not work on Windows.