My project structure is something like this:
- my_pkg
setup.py
README.md
- my_pkg
__init__.py
__main__.py
- src
app.py
part.py
__init__.py
- tests
test_app.py
test_parts.py
__init__.py
In test_app.py I have the following import statement:
import my_pkg.src.app as app
In my terminal I can run the file using
python -m my_pkg.tests.test_app
This runs fine without any errors, but when I right click on test_app.py and choose "Run Python File in Terminal" I get the following error:
ModuleNotFoundError: No module named 'my_pkg'
I have installed my_pkg by running:
pip install -e .
If I open up a terminal and run python and in python run "import my_pkg.src.app as app" it works fine.
What am I doing wrong. How can I get my imports to work when running my program in visual studio code?