I'm trying to understand the behaviour of VSCode in relation to running python scripts stored within sub packages of a project. If I have a project structure like the following:
proj/
util/
main/hello.py
test/
If hello.py imports from proj.util - and I use 'Run Python File in Terminal' to execute the script it fails with Module not found (proj.util) - because by default the project top level directory is not added to pythonpath. If I create an .env file in the root and add a definition for PYTHONPATH to include my project top level directory this file is equally not used when running via the option above.
If I create a default set of debug launches and use the 'debug-Python current file in terminal' - this will read the .env file and works as expected.
PyCharm automatically adds the top level project directory to sys.paths when running a script in the terminal - shouldn't VSCode provide such an option or am I missing something?
Current version is as follows, although I see the same behaviour under Windows.
Version: 1.30.1
Commit: dea8705087adb1b5e5ae1d9123278e178656186a
Date: 2018-12-18T22:23:23.072Z
Electron: 2.0.16
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Linux x64 4.19.12-arch1-1-ARCH