Hi. Trying to run an app with multiple callbacks and I’m stuck with this error when trying to run the second one.
this is the code:
—elements for dropdowns—
all_options = {
‘group_1’: series[1:5],
‘group_2’: series[6:10],
‘group_3’: series[11:-1],
}
app.layout = html.Div(children=[
html.P([html.Label(“Choose a group:”),
dcc.Dropdown(id=‘groups_dropdown’, options=[{‘label’: k, ‘value’: k} for k in all_options.keys()],
value=‘group_1’)],
style=dict(width=‘400px’)
),html.P([html.Label("Choose a series:"), dcc.Dropdown(id='series_dropdown')], style=dict(width='400px') ), dcc.Graph( id='plot_1_1', figure=fig, style=dict(width='800px') )
])
—adding callback functions—
@app.callback([Output(‘series_dropdown’, ‘options’)],
[Input(‘groups_dropdown’, ‘value’)])
def set_series_options(selected_group):
return [{‘label’: i, ‘value’: i} for i in all_options[selected_group]]@app.callback([Output(‘series-dropdown’, ‘value’)],
[Input(‘series-dropdown’, ‘options’)])
def set_series_value(available_options):
return available_options[0][‘value’]
Any help with this error would be much appreciated:
Traceback (most recent call last):
File “C:\Users\Candriam\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py”, line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 4, in
[Input(‘series-dropdown’, ‘options’)])
File “C:\Users\Candriam\Anaconda3\lib\site-packages\dash\dash.py”, line 1156, in callback
self._validate_callback(output, inputs, state)
File “C:\Users\Candriam\Anaconda3\lib\site-packages\dash\dash.py”, line 865, in _validate_callback
list(layout.keys()) + (
AttributeError: ‘Div’ object has no attribute ‘keys’