I have a simple test project with the following file structure:
- Modules
- .venv
- code
- main.py
- package
- __init__.py
- mod.py
mod.py
def add(arg1, arg2):
print(arg1 + arg2)
main.py
from package.mod import add
add(1,2)
__init__.py is empty.
I want to run add() from main.py but when I try it doesn't let me import it saying:
ModuleNotFoundError: No module named 'package'
Now, I've seen some other posts about modifying the PATH variable at run-time which I tried and it didn't work. I suspect it's because none of these solutions used a virtual-environment.