Error On Tag Script

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 :


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 ?

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.

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 :


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 :

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

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

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 :

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 ?


Can you post the exact error?

Yes, It just happened :

Here’s the value changed script :

and here’s my script hierarchy :


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

from shared import mixing

Does it complain about not finding mixing?

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 -

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 !

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 !)

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.

any suggestions ?