Overlapping Wildcard

@callback(
Output({‘type’: ‘graph’, ‘processName’: MATCH, ‘productLineName’: ALL}, “figure”, True),
Input({‘type’: ‘graph-dropdown’, ‘processName’: MATCH, ‘productLineName’: ALL}, ‘value’), prevent_initial_call=True)
def update_graph(value):

I am trying to update a graph based on a dropdown. The graph and dropdown are dynamically created with the same processNames as an index. They are guaranteed to be unique yet I am getting the overlapping wildcard.

Any help will be appreciated.

So, I am a little closer to the problem.
I ran the file here:
Dash-by-Plotly/Callbacks/Pattern Matching Callbacks/dynamic_callbacks.py at master · Coding-with-Adam/Dash-by-Plotly (github.com)

and it worked.

So then I copied everything from that file to my own page and it failed in the same way.

So then I narrowed it down to if I change my page registry parameters.

This works:
dash.register_page(name,
path=‘/’,
name=‘Graph’)

This does not work:
dash.register_page(name,
path=‘/graph’,
name=‘Graph’)

Nor this:
dash.register_page(__name, path_template=‘graph//’, name=‘Graph’)

I found my answer buried in an obscure spot on the dash.plotly.com page:

  • @dash.callback won’t work in projects with multiple app declarations. (If you are using multiple app declarations to create a multi-page app, remember that this is not officially supported and consider changing to the recommended dcc.Location multi-page app solution).

Strike that. I am no using multiple app declarations.

Problem resolved. I was importing the dataprovider I instantiated from the main app.py file which had the app.layout. This was causing the page to fire the callbacks more than once. I moved the dataprovider instantiation to another file and instantiated it there and then imported it so I could use it throughout the application.

Hello @dwmorris,

Welcome to the community!

Glad you got it figured out, in the future it makes things a lot easier to diagnose if you provide an example application that can reproduce.

^ often times you will find out how the error is being produced along the way. :slight_smile:

1 Like

Hi @dwmorris
Do you mind sharing more details about this? I ran into this problem too, where a multi-page app, when importing another pattern-matching components and instantiate it in my app.py, I got the same errors. How did you solve this?
Thanks in advance!