How to make callbacks for randomly generated components

A fundamental aspect of Dash is that every callback you app will use needs to be defined before you start the app. This means that you can’t create new callbacks within a callback. But, if you disable callback validation, then you can create new layout fragments that contain IDs which callbacks reference, but these are callbacks have to already be created previously, so the IDs can’t be actually random.

This basically means you need to enumerate all possible callback combinations (in terms of potential input and output IDs) and define them programatically.

Here’s a description of this approach: Dynamic Controls and Dynamic Output Components

1 Like