Adding templates dynamically

Hi,
I asked some time ago about the possibility to develop a script that generates Templates dynamically at runtime.
viewtopic.php?f=70&t=12212
Now I’m thinking about a vision module to get this. In particular, i would like to have a module (hosting internally a TemplateHolder) in a vision module that displays generic Templates, whose paths, dimensions, positions ecc are specified as properties.
So this module should have the capability to instantiate objects using code like this:

from com.inductiveautomation.factorypmi.application.components.template import TemplateHolder root = system.gui.getParentWindow(event).rootContainer TemplateHolder newobj = new TemplateHolder() newobj.initTemplate(root.getAppContext()) newobj.setTemplatePath("XXX") newobj.setName("A Template") newobj.getLoadedTemplate().setEnableLayout(1) root.addComponent(newobj)
I know doing this using python is not recommended by Inductive. I’d like to know if there’s a good practice you could suggest me and a reference to design and develop properly such module.
Thank you very much.