# Having trouble calling a shared script from a tag change event

**URL:** <https://forum.inductiveautomation.com/t/having-trouble-calling-a-shared-script-from-a-tag-change-event/22178>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [January 29, 2019, 12:24am UTC](https://forum.inductiveautomation.com/t/having-trouble-calling-a-shared-script-from-a-tag-change-event/22178 "2019-01-29T00:24:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Joshua](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Mr\_Joshua](https://forum.inductiveautomation.com/u/Mr_Joshua)\
**Post date:** [January 29, 2019, 12:24am UTC](https://forum.inductiveautomation.com/t/having-trouble-calling-a-shared-script-from-a-tag-change-event/22178/1 "2019-01-29T00:24:19Z")

</div>

Trying to do something a bit difficult: change UDT parameters using a expression tag’s value change event.  
Someone else already did the hard work: figured out how to write UDT parameter in runtime.  
Here is the code:  
from com.inductiveautomation.ignition.common.config import Property, BasicProperty  
from java.lang import String

def writeUDTParameter( tag, key, value ):  
propertiesList = system.tag.read( ‘%s.ExtendedProperties’ % tag ).value   
propertiesList.set(BasicProperty( key, String ), value)   
system.tag.editTag( tagPath=tag, attributes={ ‘ExtendedProperties’: propertiesList } )

Code works fine in the Script test window. Put it into the shared Script library, and when I call it from the Tag Change event:  
shared.writeUDTParameter(’[default]San Antonio/DailyTest/DailyFloats’, ‘monthtgt’, currentValue.value )

I get this error:  
File “tagevent:valueChanged”, line 2, in valueChanged  
AttributeError: ‘com.inductiveautomation.ignition.common.script.Scr’ object has no attribute ‘writeUDTParameter’

I am pretty novice with scripting, so I am probably just getting some of the syntax wrong. Any help would be appreciated.  
Thanks!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 29, 2019, 1:04am UTC](https://forum.inductiveautomation.com/t/having-trouble-calling-a-shared-script-from-a-tag-change-event/22178/2 "2019-01-29T01:04:33Z")

</div>

> [@Mr\_Joshua](#):
>
> shared.writeUDTParameter

You seem to be missing the name of the shared script in between 'shared' and 'writeUDTParameter'.

---

<div class="post-metadata">

**Author:** ![Mr\_Joshua](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Mr\_Joshua](https://forum.inductiveautomation.com/u/Mr_Joshua)\
**Post date:** [January 29, 2019, 1:51am UTC](https://forum.inductiveautomation.com/t/having-trouble-calling-a-shared-script-from-a-tag-change-event/22178/3 "2019-01-29T01:51:04Z")

</div>

That was it!  
Thanks Phil!
