Creating param fields at runtime?

What’s the best way to get a Parameterized class to have an array of identical param fields without declaring them explicitly? The use case is a list of checkboxes in a Panel UI.
Is there are way to create param fields at class/object creation instead of having

box1 = param.Boolean(True)
box2 = param.Boolean(True)

box20 = param.Boolean(True)

If I understand you correctly, you essentially want to have a dynamic list with dynamic possible entries where the contents of this list are defined through a number of toggles?

If so, you can use a ListSelector. You can edits its possible values through its objects attribute dynamically.
Then, as a Panel widget, you could use a ToggleGroup, via

pn.Param(
    self.param.selected_entries,
    widgets={"selected_entries": pn.widgets.ToggleGroup},
)

Look into the .param.add_parameter method documented here. Note that I think it’s pretty much entirely untested so try to make sure things work as you expect after using it :upside_down_face: Or you could build your class as a string and use exec.