# Hosting templates in modules

**URL:** <https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622>\
**Category:** 3rd Party Modules\
**Created:** [June 26, 2014, 7:29am UTC](https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622 "2014-06-26T07:29:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [June 26, 2014, 7:29am UTC](https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622/1 "2014-06-26T07:29:13Z")

</div>

Any way to host/load a template object (from the project) in a SDK-developed module?  
Unfortunately i don’t see template-related classes in the javadocs ☹  
Thanks

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [June 26, 2014, 2:14pm UTC](https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622/2 "2014-06-26T14:14:48Z")

</div>

Hi Mario,  
This is how we do it. We store the templates to a proj file, and import with the following one liner

```auto
new ProjectImporter(context, Project.fromXML(getClass().getResourceAsStream("templates.proj"))).open()
```

That should do it!

---

<div class="post-metadata">

**Author:** ![marioquark](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@marioquark](https://forum.inductiveautomation.com/u/marioquark)\
**Post date:** [June 26, 2014, 3:19pm UTC](https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622/3 "2014-06-26T15:19:56Z")

</div>

uh,  
very interesting.  
is “templates.proj” the gateway file path of the project file?  
once loaded, how can i draw a template holder in a vision client module? this is the main question.  
i didn’t find in the SDK manual or in the javadocs any possibility to do this.  
thank you!

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [July 5, 2014, 3:36am UTC](https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622/4 "2014-07-05T03:36:04Z")

</div>

Sorry for my delayed response. This code would have to run in the designer. Typically, we would have this code inside a called, as an example, system.ctg.install().

This will do some code, and when the snippet I supplied is executed, it will pop up the import window in the designer.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [July 7, 2014, 10:35am UTC](https://forum.inductiveautomation.com/t/hosting-templates-in-modules/8622/5 "2014-07-07T10:35:44Z")

</div>

Hello Kyle,  
I’m also intersted in marioquark’s question. Next my tests: started with the HelloWorldComponent included in the SDK example - it works pretty good! Then I asked myself: can this HelloWorldComponent instantiate, configure and bind one or more of the Templates defined in my project automatically, i.e. just by adding some lines to the HelloWorldComponent.java class provided in the SDK - e.g. like addTemplate(“xxxx”) …?

Any suggestion?

Thank you in advance, regards
