Python not wait for sub Function
@DavinE is your @ui.in_background needed?
@cvp, Honestly ? xD
i have no idea why i set this....
what does @ui.in_background and @on_main_thread exactly
@DavinE There are two base threads in Pythonista and you can force to run a process in The main_thread or in tHe ui one.
Remove this line and it is still not ok, put the line @on_main_thread
@cvp like this:
@on_main_thread def generatePDF(...)
def setFileNamePDF(self, customer, customer_project, materiallistType)
@DavinE Sincerely, I don't know but personally I would put the @on_main_thread before the other def.
@cvp okay thanks i try it and response to you xD
montykit last edited by
Is it possible to launch a python command without waiting for a return ? and therefore start the next command without waiting the previous one to finish ?
I searched and asked also on StackOverflow but so far I didn't found what I was looking for...
something that look promising might be the
concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
as seen here -> https://stackoverflow.com/a/60832288/11943028
But this example is focus on results that I don't need. any ideas ?
in my case
@ui.in_backgroundworks... and don't wait for a return
maybe for you too
@montykit see the threading module, you could start one thread for each command
But what do you call a command?
import threading class MyThread(threading.Thread): def __init__(self,cmd): threading.Thread.__init__(self) self.run = cmd def cmd1(): s = 0 for i in range(1000): s += 1 print(s) def cmd2(): s = 0 for i in range(1000): s += i print(s) MyThread(cmd1).start() MyThread(cmd2).start()