✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚡️ Concerned about the grid? Kyle Baranko teaches how to predicting peak loads using XGBoost. Register for the August webinar!

Dynamic layouts break auto-generated callbacks

Dash==1.20.0

I have a function which: accepts (dash_app, component_id) as arguments, generates a Dash component and sets a callback on it, then returns the component.

If used with a static layout, this works fine.

If used with a dynamic layout (app.layout = some_layout_func), it breaks, complaining I have duplicate callback outputs and inputs.

(I have tried functools.lru_cache in various places but this does not help, I suspect its somehow related to threading? The function seems to get called multiple times w/ the same cache key… despite the fact its supposed to be a cached function. )

how to fix this to work with dynamic layouts? thanks