Thats weird. What kinds of things are after the callAsync() call? You’re reading all this, what are you doing with it?
Also just a note, I would really suggest making a list of tagPath % i in an array, then using system.tag.readAll() - in my experience, much faster than reading 1 at a time.
I am building a dataset with the results, but I actually commented out the rest of the code to verify where the hang up was, and it is in the for loop / read tags call.
See this link for these helpers. callAsync just constructs a function with the arguments in its closure and passes it to invokeAsynchronous().
The lockup is possibly related to using print from a background task, which is a forbidden UI operation. { Use a logger in the background, but only if you must. } However, each read() will make a gateway round trip. That might be interfering with normal polling for the UI. Try making both changes, one at a time.
You should never put read() in a loop like this anyways. Get them all in one call, then loop through the results separately.
Thanks for all the advice. I followed it, and I was able to speed things significantly. Mainly, placing the tag paths into a list and making a single call with the system.tag.readAll() method. Here is the code I ended up with.
Consider putting your cip_path() function in a script module. You’re wasting time redefining it on every event. Also consider placing your dictionary of constants in a script module, but don’t name it dict. That’s a predefined function in python. Assigning to that name blocks access to the function in that scope.