Passing data between callbacks and multiple callback outputs, better approach

I recently started using dash.
One of the things I found that callbacks can send multiple outputs but dash doesn’t recommend it.
I have a dash board that has multiple graphs.

I tried two options:
Option 1: Used a single callback to process data for graphs, create the graphs and render the page. This works fine, all graphs render at the same time, actually page loads quite fast.
Option 2: Did aggregation in a callback and passed this data to individual callbacks for each figure. This also works. However, individual graphs render one after another and it seems full dashboard gets displayed in bit more time than in the option 1. Page rendering also looks clumsy compared to option 1.

My question is what is a best approach for callbacks that display multiple graphs and why is not having multiple callback outs not a recommended approach. Right now I am leaning towards option 1 even though it makes call back function but hard to manage.

Any response is appreciated.

Hi @rajeshdhar

You tagged the post as Plotly.py instead of tagging as Dash (first option).

Where did you see the recommendation to not use multiple outputs for a callback :thinking:

https://dash.plotly.com/basic-callbacks

under Dash App With Multiple Outputs

The answer is in the link you provided, the documentation do not say that doesn’t recommend multiple output, it’s saying that in certain circumstances you can have better aproches:

"A word of caution: it’s not always a good idea to combine Outputs, even if you can:

  • If the Outputs depend on some but not all of the same Inputs, keeping them separate can avoid unnecessary updates.
  • If they have the same Inputs but do independent computations with these inputs, keeping the callbacks separate can allow them to run in parallel."

That because:

  • When the callbacks use different inputs the problem is that when one input is changed all the graphics will change, and not only the one that has the input changed.

  • And when the callback do different computations for each output is not recomended (because spend time that can be done in parallel).

I think is only for that reason and depends on your particular case.