Python supports threading in much the same way as many other languages do. Most threading functions are made available by adding the code import threading to the top of your Python script.

Gracefully Exiting Multiple Threads

I followed this example at for the most part, except I discovered the example code was buggy and had to make some tweaks, as outlined below.

 Note that the code in class MyThread1 can be copied to create as many threads as you want (for example, to create MyThread2).


The Columbus Radio project uses multiple Python threads for the UI control. The code is in the ColumbusRadio repo on GitHub. The threads should gracefully exit if Ctrl-C is pressed in the terminal while they are running.