Is it possible to change initial app constructor by using callback?

I wonder if it is possible to change the initial configs when first declaring with app constructor later on, with something like the path for background_callback_manager.

from dash import Dash,DiskcacheManager,callback
import diskcache

cache = diskcache.Cache("./cache")
background_callback_manager = DiskcacheManager(cache)

app = Dash(__name__, background_callback_manager=background_callback_manager)

#using some kind of callback to change the initial cache folder
@callback(
    #Output('update background_callback_manager path')
    #Input('new_path')
    )
def function(path):
    return path

I can’t say for sure that this is 100% percent impossible, but even if it is, I’m fairly sure this would be an unhappy path to travel.

The fundamental reason for this is that Dash is designed to be stateless. As discussed in the Dash docs, this is so that you can scale your Dash app over multiple worker processes/containers/servers. Changing a config value in a callback would only apply to one of the serving nodes and would not propagate to others. So the next callback submitted by the same user could be handled by a process with the previous config value.

Even if you could ensure that no one would ever deploy the app over multiple worker nodes, if you have multiple users, one user’s change to this config param would affect every other user of the app without them opting into that change, which may not be a great user experience.