Pros and Cons of multiple callbacks triggered by the same input

Hi there,
my dashboard quickly expanded in the last couple of months and i am asking me the following question right now: Which are the pros and cons of using multiple callbacks for output which also could be standing in one callback.

In my case every plot, every info, just everything is triggered by one buttonclick in one callback (like 70 outputs or so). I could easily creater smaller callbacks which may be divided by topic or if plots are shown on different tabs. One of the cons would be that there is a small piece of code in the beginning i need to redo, but that is very cheap for me at the moment. On the other side, if i am correct, the multiple callbacks are run in parallel (!?) which may lead to faster time for some figures on differen tabs.

Let me be part of your experiences and knowledge

If there is no dependency between the Output()of your callback, I would separate them into single callbacks. If there is some dependency (maybe you calculate something for Output1 and use the calculated values to create Output2 within your callback function) you would have to use chained callbacks.

The order of the single callbacks might be a point to consider, if by separating into single callbacks you’d need to use allow_duplicates=True i.e an Output() is referred to from multiple callbacks.

I really like this expression! :wink:

2 Likes