How to send a filename to start a Dash App

I can start a Dash app by using app.run(debug=True)

Now, I need to send a filename to start the Dash App. The Dash App will load the file from the filename, and then do some calculations. How to do that/load filenames to start the app?

Did not find examples online

Depending on how you start the app, one option could be to use pass command line arguments? Another option could be environment variables.

Another option could be a “config” file.

Sounds good to be a solution.

I can write the filename to configure file, and then Dash.app can load a fixed configure file.

I am wondering whether the run function below allows me to deliver a parameter like a string for filename to be loaded

app.run(
    host='127.0.0.1',
    port='42843',
    proxy=None,
    debug=None,
    jupyter_mode: typing_extensions.Literal['inline',
    'external',
    'jupyterlab',
    'tab',
    '_none'] = None,
    jupyter_width='100%',
    jupyter_height=650,
    jupyter_server_url=None,
    dev_tools_ui=None,
    dev_tools_props_check=None,
    dev_tools_serve_dev_bundles=None,
    dev_tools_hot_reload=None,
    dev_tools_hot_reload_interval=None,
    dev_tools_hot_reload_watch_interval=None,
    dev_tools_hot_reload_max_retry=None,
    dev_tools_silence_routes_logging=None,
    dev_tools_prune_errors=None,
    **flask_run_options
)

OK. I finally solve it.

I create a class as wrapper, where Dash app is an attribute in the object.

The instance of this class will load files first, and then start the Dash app