Configure the path of the default "run in terminal" option

58 Views Asked by At

I've recently tried running my Python project in VSCode.

I have in my code imports from other files withing my project. The problem is that when I try running it from the default "play button"/"run in terminal" option, it does not detect my other files. (I opened the entire project's folder, as well as created a workspace with it))

When I created a debug configuration, this line was added automatically:

"env": {"PYTHONPATH": "${workspaceRoot}"}

which enabled the requested import.

I was still not able to figure how to make it work with the default "play button". (e.g see what run configuration it uses, etc)

Thanks for your help! <3

1

There are 1 best solutions below

0
On

The fix was adding:

"terminal.integrated.env.windows": {"PYTHONPATH": "${workspaceFolder}"} 

to settings.json and restarting VSCode