I experiment some script on ignition but i’m not able to show the proper result.
Just want to have delay on printing.
When not using async, it works. But I want to retain the usage of async.
Hope someone can help me.
Sample script:
import threading
import time
def count():
for x in range(1,10):
print x
time.sleep(1)
def func():
x = threading.Thread(target=count,args=())
x.start()
x.join()
system.util.invokeAsynchronous(func)
I just put your code on a button, and it gives the correct output (printing 1 to 9 in the designer console).
Are you sure it’s getting executed in the right context? When you run it in a gateway script or on a gateway tag trigger, the print will happen in the gateway and not in the designer. Did you try with a regular print?
The threading functionality is used in many external libraries, and these libraries work fine in Ignition. So using it in your scripts should also work fine.