How to create an output on a tab with the inputs of another tab?

Hi everybody I try to create an output on a tab with thr inputs of another tab but i get this error : A nonexistent object was used in an Output of a Dash callback. The id of this object is fig and the property is figure.
please i need your help. thank you

Hi,

Welcome to the community!

I imagine you are using the “Method 1” described in the docs, where the tab content is rendered dynamically via a callback, right?

If that is the case, then the problem is very likely to be that you don’t have the components from the first (where the inputs are) and second tabs in the layout simultaneously. In other words, if you change to the second tab (and then the callback is triggered), the components in the first tab are gone.

There are two simple alternatives to this:

  1. Switch to “Method 2” of tabs (as in here). In this case, all components of all tabs will remain in the layout. Note that this method requires all callbacks to run and all components to render, so it is not the best approach for multiple tabs and “slow” callbacks.

  2. Use a dcc.Store component to save the selections made in Tab1, then use two separated callbacks: one to update the data of Store, other to update Tab2 with the values in Store. Just make sure to define the Store component outside the Tabs (for example, under the first html.Div), otherwise you’ll run into the same problem described above.

Let me know if this helps you!

1 Like

hi I used the dcc.store and that seems to solve part of my problem however the tab where the input is located does not react directly to the output I have to quit and come back to the page to have an output.
But thank you

hi @jlfsjunior it’s good i was able to solve the problem thank you for your help.
By the way, I want to be a data scientist like you

3 Likes

Hi there, I have a similar problem and am trying to work it out with the dcc.store component. However, I can’t figure out how other tabs (stored in separate files) can access this dcc.store comonent… I import the layouts of those other three tabs into the main page file, but they don’t see the storage component within their layouts/callbacks… And if I try to import it into the tabs, I get the circular import error… Would be grateful for any tips!