This took me longer to figure out than I’d like. The Textual console is good for debugging the Textual parts of your code but having the debugger working is good too.
So my code structure is something like:
/cli/app.py
/cli/__main__.py
The app.py file contains the App() and the __main__.py simply contains:
from .app import main
if __name__ == "__main__":
main()
The .vscode/launch.json file then just needs to have:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Textual",
"type": "debugpy",
"request": "launch",
"module": "cli",
"console": "integratedTerminal",
}
]
}
I’d been trying to use a module value of textual and I’d tried using the normal way of running the code with "program": "cli/app.py" but wasn’t having much joy with paths breaking etc.