Hello everyone, I’am having problemes using callbacks :
def create_callback(app, i):
@app.callback(
[Output(f"loco{i}", "children"),
Output(f"loco{i}", "style")],
[Input("tabs-example", "value"),
Input("sous-tabs", "value")],
[State(f"loco{i}", "id")],
)
def render_content(tab, stab, loco_id):
try:
locomotive = get_list_locomotives_with_model_DE18()[i - 1]
resultat = (show_locomotive_health(i), {})
except IndexError:
resultat = (None, {'display': 'none'})
return resultat
for i in range(1, 201):
create_callback(app, i)
This callbacks update components with their IDs, but I recieve this issue :
{
“message”: “Duplicate callback outputs”,
“html”: “In the callback for output(s):\n loco200.children\nOutput 0 (loco200.children) is already in use.\nAny given output can only have one callback that sets it.\nTo resolve this situation, try combining these into\none callback function, distinguishing the trigger\nby using dash.callback_context
if necessary.”
}
I don’t understand, because each callbacks has a different output, Could anyone help me ?