Visual Studio Code only supports one launch.json file. However, it supports two or more configurations that appear in the debug pane's drop down list (instead of "No Configurations").
In the DEBUG pane, either click the Config button circled in red above or click the blue link "create launch.json file":
Click it and it creates a launch.json file with debugging configurations. Edit this file and add the args in this key-pair format AND add multiple for different args including Variable Substitution!
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File with my args",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"--username", "Jeremy",
"--account", "Stackoverflow"
],
"console": "integratedTerminal"
},
{
"name": "Python: Current File with UserName arg",
"type": "python",
"request": "launch",
"program": "${file}",
"args": ["${env:USERNAME}"],
"console": "integratedTerminal"
}
]
}
Set your desired Config Option in the drop down and put a breakpoint in your Python script, for example on the first line under def main(...)
and then press F5 or Run> Start Debugging.
Pro Tip: see the Variable Substitution reference its the perfect way to automate things for the whole team by not hardcoding individuals info or settings in the configs instead using things in Build Pipelines such as Environmental Variables from the get go!
Pro Tip:
Default settings (hardcoded POCO constructor values).
A settings (aka launch.json) file to override the default hardcoded values using optional settings.
Environmental Variables to override any setting.