Problem with invokeLater


we have actually a problem with the function invokeLater.
We are trying to call a GLOBAL SCRIPT called “Reader” with the function “readAll” that is like this:

def readAll(ip,db):
dtNow ="[System]Gateway/CurrentDateTime").getValue();
minutes= dtNow.getMinutes();

def later():
now ="[System]Gateway/CurrentDateTime").getValue()
call = system.db.createSProcCall(“usp_Write_Log_Ignition”, db)

 procedure_name= "Ignition_Log"
 call.registerInParam("ID_PROCEDURE_NAME", system.db.VARCHAR, procedure_name)
 message_type = 0
 call.registerInParam("ID_MESSAGE_TYPE", system.db.INTEGER, message_type)
 call.registerInParam("DS_MESSAGE", system.db.VARCHAR, 'test1')
 call.registerInParam("DT_PROCEDURE_TIMESTAMP", system.db.TIMESTAMP, now)


When we call the global script from a Tag value changed (with shared.Reader.readAll("", “dbscada”)), we have this error:
AttributeError: ‘com.inductiveautomation.ignition.common.script.Scr’ object has no attribute 'invokeLater’

We need to log a string, but we need to wait 10 seconds after the tag changed, so we used the invokeLater.

Could you please help us to solve this problem?


invokeLater is only available in the client and designer scopes because it is specifically for launching a task on the EDT, the thread that runs the UI.

You probably need to use invokeAsynchronous and a call to sleep (yuck):

1 Like