# Create a set of template instances using scripting

**URL:** <https://forum.inductiveautomation.com/t/create-a-set-of-template-instances-using-scripting/98155>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [November 4, 2024, 8:43pm UTC](https://forum.inductiveautomation.com/t/create-a-set-of-template-instances-using-scripting/98155 "2024-11-04T20:43:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauricio\_caceres](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mauricio\_caceres](https://forum.inductiveautomation.com/u/mauricio_caceres)\
**Post date:** [November 4, 2024, 8:43pm UTC](https://forum.inductiveautomation.com/t/create-a-set-of-template-instances-using-scripting/98155/1 "2024-11-04T20:43:29Z")

</div>

Hi there!  
I want to run a script to create and bind a set of template instances. I've been looking for some solution to this without success.  
Some of you have already tried to do this?  
Thanks

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [November 4, 2024, 8:50pm UTC](https://forum.inductiveautomation.com/t/create-a-set-of-template-instances-using-scripting/98155/2 "2024-11-04T20:50:08Z")

</div>

What platform, Vision or Perspective? What are you binding the template instances to, tags? If that is the case, the proper approach is to pass the tagpath to each instance using parameters and use the path to indirectly bind a custom property on the instance to the tag.

If you have multiple instances, consider using a [template repeater](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/vision-components/containers/template-repeater)/[flex repeater](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-embedding-palette/perspective-flex-repeater) or [template canvas](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/vision-components/containers/template-canvas)/[view canvas](https://www.docs.inductiveautomation.com/docs/8.1/appendix/components/perspective-components/perspective-embedding-palette/perspective-view-canvas)

The following forum posts may provide insight.  
For vision:

> [@Adding Tag Bindings to Components Through a Script](https://forum.inductiveautomation.com/t/adding-tag-bindings-to-components-through-a-script/97416/3):
>
> If I'm correct in my assumption, consider the following approach: Create a single template called something along the lines of AnalogCardPoint or similar. Create a parameter called baseTagPath and index. Create a custom property called tagValue. Create an indirect tag binding on tagValue that looks something like {1}/{2}/Data. In the box below the indirection string {1} should be linked to baseTagPath and {2} should be linked to Index You can then take this template and use it in a template re…

For perspective:

> [@Flex Repeater: Incrementing Tag Values on Button Click](https://forum.inductiveautomation.com/t/flex-repeater-incrementing-tag-values-on-button-click/97798/4):
>
> Sure, Right now you are passing the repeated view the tag path and the tag's value(I assume) so you can display it. Instead, create a custom property on the repeated view and indirectly bind to the tag using the tagPath parameter. Make sure the binding is bidirectional. Bind your tag value display (label or whatnot) to the view.custom.tagValue property. Then, the script on your increment button on the repeated view can be as simple as def runAction(self, event): self.vi…

Searching for `indirect tag binding` on the forums will give you many more posts and examples. Consider also consulting the [manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/vision/vision-templates/template-indirection) and [inductive university](https://www.inductiveuniversity.com/videos/perspective-indirect-tag-binding/8.1) (free).
