Passing variables from one update function to another

Hello, is there away to return the results from one function attached to a callback to another function tied to a different callback? (Goal: After 2 different files have been parsed (1 containing raw data which will have a regression performed on it, and another independent file that has labels for each regression) I would to display a plot of the regression through dcc.Graph() after the related label has been selected from a dropdown menu.) How would I be able to get the 2 outputs from these 2 different callback functions and pass them to a dcc.graph() callback after a dropdown selection? Thank you.

def update_output(contents,file_names):
    if contents is not None:
        children=[parse_data(a,b) for a,b in zip(contents,file_names)]
        print(children[0][1])
        
        return children[0][0]

@app.callback(Output('dropdwn','options'),
              Input('upload-cmp_nme', 'contents'),
              State('upload-cmp_nme','filename'))                             

def update_output(contents,file_names):
    #print(contents,file_names)
    print(children[0][1])
    if contents is not None:
        options=[parse_platemap(a,b) for a,b in zip(contents,file_names)]
        #print(options[0]['value'])
    else:
        options=[{'label':"",'value':""}]   
   
    return options[0]    

Hi @KofiM

You can pass the variable to a dcc.Store and take from the Store to the other callback, se here:

https://dash.plotly.com/dash-core-components/store

Hi Eduardo,

Thank you for your response, are there any other resources/examples on the topic of dcc.Store()? I am finding trouble trying to tie my needs with the example provided.

@KofiM

Take present that the information stored in the dcc.Store must be json data.

You can try to find other users answers related to dcc.Store.

Also perhaps this link can give you additional options for your issue:
https://dash.plotly.com/sharing-data-between-callbacks

Hope it helps :grinning: