invokeAsync decorator

got it.

def async(func):
	def inner(*args,**kwargs): 
		def async(func=func,args=args,kwargs=kwargs):
			func(*args,**kwargs)
		system.util.invokeAsynchronous(async)
		
	return inner
	
@async
def somefunc(p1,p2):
	print str(p1+p2)
	
print "1"
somefunc(1,1)
print "3"

ref: Update GUI via Asynchronous thread

2 Likes