Currently I have my file structure like this:
├── Utilities
| ├── __init__.py
│ ├── module1.py
├── main.py
├── global_var.py
In main.py and module1.py I have already written import global_var, and everything goes well when I run main.py.
However, when I tried to debug or run module1.py itself, it always shows
Exception has occurred: ModuleNotFoundError
No module named 'global_var'
And I have to manually move module1.py to the same folder with global_var.py so that it can run successfully.
I would like to know how to set the launch.json to stop moving the files. Here's my launch.json right now:
{
"name": "Python: Modules",
"type": "python",
"request": "launch",
"program": "${file}",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal"
}