# Error On Tag Script

**URL:** <https://forum.inductiveautomation.com/t/error-on-tag-script/31339>\
**Category:** Ignition\
**Created:** [January 16, 2020, 2:53pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339 "2020-01-16T14:53:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 16, 2020, 2:53pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/1 "2020-01-16T14:53:58Z")

</div>

I have a memory tag in a default tag provider which executes once a day automatically by gateway event script and can be manually called by button on vision ! This memory tag calls for the script located in the shared library !  
which looks like :

```auto
shared.process.advanced.myfunc()

```

Now, when it executes, sometimes it throws an error as process not the attribute of the string !

is there any better way to prevent this ?  
Thanks

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [January 16, 2020, 2:57pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/2 "2020-01-16T14:57:32Z")

</div>

I think you would have to give more information. You mentioned a memory tag and how you call a script but don’t know anything about the script to be able to say why you would get an error. Also does the error happen when it is done automatically, manually or both? Info is key.

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 16, 2020, 3:05pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/3 "2020-01-16T15:05:40Z")

</div>

Here’s the modifies question -

I have a Memory tag in default tag provider which has a datetime datatype.

The script for the valueChangedEvent of that memory tags looks something like this :

```auto
shared.process.advanced.myfunc()

```

Now, I have a gateway timer script which basically changes the value of that tag once a day so that the scipt can be executed.

The Gateway Event Timer script looks like :

```auto
from java.util import Date
import system
lastExecutionPath = "[default]Facility/oee-web/lastExecutionTime"

def checkTrigger(lastExecutionPath):
   from java.util import Date
   import system
   lastExecution = system.tag.read(lastExecutionPath).value
   nextExecution = Date(lastExecution.year, lastExecution.month, lastExecution.date, 02, 00, 00)
   
   if nextExecution.time < lastExecution.time :
   	nextExecution = system.date.addDays(nextExecution, 1)
   	
   now = Date()
   
   if nextExecution.time <= now.time:
   	system.tag.write("[default]Facility/oee-web/lastExecutionTime", now)
   	
   	logger = system.util.getLogger("SyncOEEMasterData ")
   	logger.info('In Process !')
   
checkTrigger(lastExecutionPath)

```

As per this, the tag gets changed once a day at around 2 AM.

The memory tag has a Value changed - Tag event Script which calls a function !

Now, when I say Manually, the button on the vision changes the datetime value on the tag which makes it perform the same execution as Automatic would do !

button script :

```auto
from java.util import Date
import system

now = Date()
system.tag.write("[default]Facility/oee-web/lastExecutionTime", now)

```

Now, both in auto and manual mode, sometime it gives me an error saying process attribute does not exists.

So, is there any way to run the shared script once a day ? maybe with a gateway timer ?

Thanks

---

<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:** [January 17, 2020, 3:29pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/4 "2020-01-17T15:29:15Z")

</div>

Can you post the exact error?

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 17, 2020, 6:44pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/5 "2020-01-17T18:44:37Z")

</div>

Yes, It just happened :

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/77b386819c68da193b077c522707acab533173bb.png)

Here’s the value changed script :

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/aaa988dc36b60c7e8277269a28f893cc803e8329.png)

and here’s my script hierarchy :

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/539dcd16b6c8b8f5c3aac7ba5a123e8228c55c81.png)

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [January 17, 2020, 8:42pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/7 "2020-01-17T20:42:39Z")

</div>

Did you recently create one of the script packages or scripts and not publish them?  
That error means it cannot find the mixing script package.

I just tested this by going down 5 levels deep with packages and then a script and didn’t have an issue.

If you put

```auto
from shared import mixing

```

Does it complain about not finding mixing?

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 18, 2020, 8:09pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/8 "2020-01-18T20:09:57Z")

</div>

No, whenever I test, I make sure that the newest version is published ! But, I had never seen that error before ! Also as I said, it doesn’t always fault out !

Thanks for -

```auto
from shared import mixing

```

I didn’t knew I can import the module like this ! I have tried out, I might have to wait for another day to see if it errors out !

Thanks so much !

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 18, 2020, 9:26pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/9 "2020-01-18T21:26:44Z")

</div>

Okay, that doesn’t work ! The problem is, I need the access to that script from 2 different project so I can’t move it to Project (well I can, but do not want to create confusion by doing that !)

---

<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 18, 2020, 10:34pm UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/10 "2020-01-18T22:34:00Z")

</div>

> [@kaushik.shah](#):
>
> from shared import mixing

This type of import is really not a good idea. When a module is pulled into another namespace like this, the name points at that version of mixing. Though it shouldn't matter, there have been cases where the old version remains in effect in other modules. Always use the full script and function name.

---

<div class="post-metadata">

**Author:** ![kaushik.shah](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@kaushik.shah](https://forum.inductiveautomation.com/u/kaushik.shah)\
**Post date:** [January 21, 2020, 12:12am UTC](https://forum.inductiveautomation.com/t/error-on-tag-script/31339/11 "2020-01-21T00:12:55Z")

</div>

any suggestions ?
