# Multiple callbacks for an output

**URL:** <https://community.plotly.com/t/multiple-callbacks-for-an-output/51247>\
**Category:** Dash Python\
**Tags:** show-and-tell\
**Created:** [March 21, 2021, 9:28am UTC](https://community.plotly.com/t/multiple-callbacks-for-an-output/51247 "2021-03-21T09:28:06Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Emil](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emil/32/31734_2.png) [@Emil](https://community.plotly.com/u/Emil)\
**Post date:** [March 22, 2021, 10:03am UTC](https://community.plotly.com/t/multiple-callbacks-for-an-output/51247/5 "2021-03-22T10:03:29Z")

</div>

It is an issue that is rather common to encounter is Dash\*\*. The “standard” solution is to create one combined callback, which will typically require mixing the logic of otherwise unrelated functions along with not-so-nice dispatch logic (a lot of conditional statements based on inspection of which component triggered the callback).

As a concreate example, consider logging. Say that you have “create”, “save”, “update”, “load”, etc. buttons that perform separate actions, but all needs to write some logging information (e.g. if an error occurs) to the same output. With `MultiplexerTransform` you can create an a callback for each button with their respective logic. Without it, you would have to create one callback to handle all actions, which will become rather messy (:

\*\* Here are just a few threads on the topic,

> [@Best approach to accomodating multiple callbacks for an output](https://community.plotly.com/t/best-approach-to-accomodating-multiple-callbacks-for-an-output/32788):
>
> As far as I am aware it is still not possible to have multiple callbacks with the same output, but getting around this limitation means creating large callback with all the various inputs that might change a given output, which implies a lot of extra data potentially coming across this wire. So, my questions are: (a) is there planned support for multiple callbacks with the same output in the near future? (b) if not, are there any recommended tips, tricks, best practices for getting around this…

> [@It's not possible to have multiple callbacks/Output for same object(graph)?](https://community.plotly.com/t/its-not-possible-to-have-multiple-callbacks-output-for-same-object-graph/27622):
>
> I have a list of buttons that should individually update the same graph, and instead of writing them all as individual inputs to the same callback I have created a for loop to create the callbacks for each button, but i get the following error: Multi output …ButtonGraph.figure… contains an Output object that was already assigned. Duplicates: {‘ButtonGraph.figure’} Is there any way to allow duplicates or do i have to create one callback with one ouput for all inputs for all buttons? Example c…

> [@Why can an output only have a single callback function?](https://community.plotly.com/t/why-can-an-output-only-have-a-single-callback-function/14691):
>
> Just curious, why is this a requirement? You have already assigned a callback to the output with ID "some\_id" and property "value". An output can only have a single callback function. Try combining your inputs and callback functions together into one function assume as a sketch example I have html.Button(id="reset") html.Button(id="double") dd.Input(id="field") and I want to reset field when I press reset and double its value when I press double @app.callback(dd.Output('field', 'value'),[ d…

---

_[View the full topic](https://community.plotly.com/t/multiple-callbacks-for-an-output/51247)._
