def f1():
print('play_wav')
play_wav(fn)
def f2():
print('post_to_rpi_api')
post_to_rpi_api(signals)
# executor = concurrent.futures.ThreadPoolExecutor(max_workers=2)
# executor.submit(f1)
# executor.submit(f3)
# executor.submit(f2)
th1 = threading.Thread(target=f1)
th2 = threading.Thread(target=f2)
th1.start()
th2.start()
https://github.com/SenriYoshikawa/SoapBubble/blob/master/raspberrypi/web_client.py
thread = threading.Thread(target=self.run, args=())
thread.daemon = True # Daemonize thread
thread.start() # Start the execution
http://sebastiandahlgren.se/2014/06/27/running-a-method-as-a-background-thread-in-python/
一行で書ける
def hello():
print('hello')
Thread(target=hello, daemon=True).start()