# Pass UDT to a Window via python script

**URL:** <https://forum.inductiveautomation.com/t/pass-udt-to-a-window-via-python-script/12294>\
**Category:** Ignition\
**Created:** [October 27, 2016, 12:51am UTC](https://forum.inductiveautomation.com/t/pass-udt-to-a-window-via-python-script/12294 "2016-10-27T00:51:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [October 27, 2016, 12:51am UTC](https://forum.inductiveautomation.com/t/pass-udt-to-a-window-via-python-script/12294/1 "2016-10-27T00:51:08Z")

</div>

I want to pass a UDTProperty parameter to a Window via script, but I can't work out how to convert the UDT tagpath string to a UDTProperty type.  
I have at the moment this script on the mouse release action of a button:

[code]tanknum = event.source.parent.getComponent('List').getSelectedValue()  
tankUDT = 'Deep South Tank Farm/Tank 9008' #set to a static string for testing only. this is the UDT tagpath

system.nav.swapTo('Main Windows/Tank Detail', {'TankUDT' : tankUDT})  
[/code]

This results in the error:

> [@](#):
>
> Error setting parameter: TankUDT. Could not convert Deep South Tank Farm/Tank 9008 into UDTProperty.

How do I resolve this?

PS Still very new to Ignition so apologies in advance!

Thanks

Nick

---

<div class="post-metadata">

**Author:** ![Chris\_Taylor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chris_taylor/32/3315_2.png) [@Chris\_Taylor](https://forum.inductiveautomation.com/u/Chris_Taylor)\
**Post date:** [November 2, 2016, 8:01am UTC](https://forum.inductiveautomation.com/t/pass-udt-to-a-window-via-python-script/12294/2 "2016-11-02T08:01:48Z")

</div>

nminchin

I would do this differently  
on your page or template have a string that is the UDT tagpath, then have the UDT read that path using indirection.

All you have to do is pass the tagpath as a string to the page or template and it will work. this is so much more flexible as the trigger can be UDT independent and used across the project.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [November 2, 2016, 10:40am UTC](https://forum.inductiveautomation.com/t/pass-udt-to-a-window-via-python-script/12294/3 "2016-11-02T10:40:20Z")

</div>

Thanks Chris! I actually recently found another post that said to do the exact same thing. I’ve converted my page to use this instead and it’s working great 🙂

Edit: it’s also worth noting for future reference, that it’s actually far better in terms of performance to avoid passing UDTs around, and instead - as Chris suggests - passing the path to the UDT object instead.  
Linking objects to UDT instances directly can cause significant performance issues on the client, as I saw on my very first Ignition project…
