Callback not recognizing id of component

I access a callback from component

        dmc.Select(
            label="METRIC",
            placeholder=metrics_lst[0],
            data=metrics_lst,
            value=metrics_lst[0],        
            id="comp2_SELECTclick_majordropdown"
        )

which changes callback

    @app.callback(
        Output(component_id="comp3_FIGfig_majorbarchart", component_property="figure"),
        Input(component_id="comp2_SELECTclick_majordropdown", component_property="value")
    )
    def callitback(value):
        return scientific_layout(fig_barchart(value))

which changes the following graph

 dcc.Graph(figure={}, id="comp3_FIGfig_majorbarchart")

all good.

I then repeat this structure again, with component

        dmc.Select(
            label="METRIC",
            placeholder=metrics_lst[0],
            data=metrics_lst,
            value=metrics_lst[0],
            id="duh"
        )

for callback

    @app.callback(
        Output(component_id="comp9_FIGfig_timescatter", component_property="figure"),
        Input(component_id="duh", component_property="metric")
    )
    def andagain(metric):
        print(metric)
        return scientific_layout(fig_scatter(metric))

and that does not work. Specifically, it says “metric” has NoneType. This makes me think that the callback is not recognizing the component_id. Yet they both have the id “duh”, as shown above.

I’m sure I’m missing something, does anyone have any guidance?

Found it! the component_property was not equal to value.

1 Like