Referring to a variable in dash callback defined from a previous rollback

Hi,
I have a dash app where a RadioItems and Dropdown dcc are determined by callback from another dcc element in the app. Now, i want to use these two dcc values as inputs to function of another call back, but i am not sure how to refer to them. This is the code:

data_type = [‘F’, ‘M’, ‘R’]
data_dict = data_namer(names_list[:-2])[0]
plot_type = [‘Chi’, ‘AD’, ‘KS’]
app = Dash()

app.layout = html.Div(id = ‘main-div’,
children=[
html.H4(‘Raw data Statistical tests’),
html.P(‘Chose data type:’),
dcc.RadioItems(data_type, data_type[0], id = ‘type-picker’),
html.P(‘Chose data:’),
dcc.Dropdown(options = [‘Chose’], id = ‘data-picker’, multi = True),
#html.P(‘Chose R-test type:’), dcc.RadioItems(id = ‘R-type’, options = [‘chose’]),
html.P(‘Chose plot:’),
dcc.RadioItems(options=[‘Chose’], id=‘plot-picker’),
dcc.Graph(id = ‘plot’)
]

                    )

@app.callback(Output(‘data-picker’,‘options’), [Input(‘type-picker’, ‘value’)])
def data_picker(data_type):
return data_dict[data_type]

@app.callback(Output(‘plot-picker’,‘options’), [Input(‘type-picker’, ‘value’)])
def plot_picker(data_type):

if data_type == 'R':
    return ['chi', 'ks', 'ks_D_below_1', 'ad', 'chi_row', 'ad_row']
if data_type == 'M':
    return ['chi', 'ks', 'ks_1', 'ad']
if data_type == 'F':
    return ['chi', 'ks', 'ks_1',  'ad']

@app.callback(Output(‘plot’,‘figure’), [Input(‘type-picker’, ‘value’), Input(‘data-picker’, ‘value’), Input(‘plot-picker’, ‘options’)])
def plot(data_type, ):
path = app.layout[‘data-picker’].options[0]+‘/’+f’{data_type}‘+’_test’
name = app.layout[‘data-picker’].options[0]
test=test_stat(path, f’{data_type}‘)
test.stat_test()
plot = plot(test, f’{data_type}', name)
plot.plots()

In the plot function, i want to refer to the variable coming from the data-picker and plot-picker after they are defined by the previous callbacks.
any help is appreciated.

thanks

I think you should add your dataframe and describe how do you want to return.
With you recent code I think you should revise something as below:

if data_type == 'R':
    return ['chi', 'ks', 'ks_D_below_1', 'ad', 'chi_row', 'ad_row']
elif data_type == 'M':
    return ['chi', 'ks', 'ks_1', 'ad']
elif data_type == 'F':
    return ['chi', 'ks', 'ks_1',  'ad']
@app.callback(Output('plot','figure'), 
              [Input('type-picker', 'value'), 
               Input('data-picker', 'value'), 
               Input('plot-picker', 'value')])
def plot(type-picker, data-picker,plot-picker):
    dff = df[df[''] == type-picker]
    dff = dff[dff[''].isin(data-picker)]
    if plot-picker == 'chi':
        fig = ...
    elif plot-picker == 'ks':
        fig = ...
    return fig

I can’t use data-picker and plot-picker as input to the function call. It doesn’t accept them as they are strings not variables. it has to be a variable, like data_type. Which is my question. you see, the type-picker of the RadioItems has already a defined variable , which is (data_type). however, the next two dcc elements do not have a variable defined in their call because i am defining them later on through the 1st and 2nd callbacks. but now that i have defined them through the callbacks, how can i use them to define the inputs of the function of the third callback?

Hm as I said I dont have your dataframe and I don’t know what do you want to return on dcc.Graph. I think you should add dataframe (variables) and describe what do you want to return more detail.