How to not wait for function to finish python

后端 未结 5 1257
青春惊慌失措
青春惊慌失措 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:12

    You can put it in a thread. Instead of test()

    from threading import Thread
    Thread(target=test).start()
    print("this will be printed immediately")
    

提交回复
热议问题