Save a Form populated in Code for completion in the Editor later

I don’t understand your point 1, what is dsl?

I think you want to create a form dynamically. You can do that with add_component.

You can have a look at InputBox, it allows to create a form either from a list of dictionaries or with a call per added component.