Dash VSCode Debugging

When I run my Dash app from the command line using

export PYTHONPATH=./src/ && python ./src/pdv/app.py

it runs properly, however, when I try to run it with the debugger (using the following configuration in my launch.json

       {
           "name": "Python: Current File",
           "type": "python",
           "request": "launch",
           "program": "${file}",
           "console": "integratedTerminal",
           "env": { "PYTHONPATH": "${workspaceRoot}/src/"}
        },

I get the following error:

Dash is running on http://127.0.0.1:8050/

 * Serving Flask app 'app' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
No module named app

Any ideas what’s wrong with my debug configuration?

Also, the settings from here work properly, but I’m trying to run as native Dash App, instead of Flask

Open Folder to the folder where your app.py is located.

Do you mean adding this to the settings.json?

VSCode’s menu.
FileOpen Folder

This dash app is a subapp for a larger suite, and I was hoping to incorporate this into the launch.json without requiring being in a specific directory… Oddly, this seems to work if debug is set to False

I just ended up using Flask instead (for anyone with same problem)

{
            "name": "Debug pdv plots",
            "type": "python",
            "request": "launch",
            "module": "flask",
            "env": {
                "PYTHONPATH": "${workspaceRoot}/src/",
                "FLASK_APP": "${workspaceRoot}/src/pdv/DashAppDebug",
                "FLASK_ENV": "development",
                "FLASK_DEBUG": "1"
            },
            "args": [
                "run",
            ],
        }