I am looking for a workaround for the fact that only one callback can be assigned to an output:
dash.exceptions.CantHaveMultipleOutputs: You have already assigned a callback to the output with ID "group-message-area" and property "children". An output can only have a single callback function. Try combining your inputs and callback functions together into one function.
In this case, I would like my app to have a “message area” that displays result messages of different user interactions triggered by different control elements.
First idea would be to have only one callback with all the inputs, check which input has been used, and update the message. This has multiple problems:
- boilerplate code for checking which input has been used
- one huge callback function for the logic of the app, bad separation of concerns
- since the inputs trigger not only updates of the message but also other elements, we need additional callbacks - app logic is spread across those callbacks and the “big one” for updating the message
Of course each callback could just write into a separate area, but then messages accumulate and the message area does not just show the most recent one.
Any other ideas?