How to not wait for function to finish python

后端 未结 5 880
青春惊慌失措
青春惊慌失措 2021-02-19 11:42

I\'m trying to program a loop with a asynchronous part in it. I dont want to wait for this asynchronous part every iteration though. Is there a way to not wait for this function

5条回答
  •  情书的邮戳
    2021-02-19 12:26

    A simple way is to run test() in another thread

    import threading
    
    th = threading.Thread(target=test)
    th.start()
    

提交回复
热议问题