How to set a default file as the first file to run in visual studio code?

Viewed 1399

I have a project with one main function in the my_main.py file and this file is using many other files I have created. Is there a way to tell vs code to always run my_main.py each time I press Ctrl+F5 regardless of the file that I am currently working on?

1 Answers

I'm assuming you have a launch configuration in launch.json that looks something like this:

{
    "name": "Python: Current File (Integrated Terminal)",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal"
}

You can simply change the "program" to "${workspaceFolder}/my_main.py".

Related