I need to run files using python -m foo.bar.baz
due to having absolute imports in other areas of the codebase.
In VS Code, when I click the top-right corner to Run Python File
, I'd like it to automatically do python -m foo.bar.baz
instead of python /absolute/path/to/foo/bar/baz.py
. Is this possible?
Of course, this should work automatically for any file regardless of where it is, not just for baz.py
.
This question suggests modifying settings.json
but they don't provide an explicit example for how to do it exactly like this.