# Use of threading module in micropython

**URL:** <https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133>\
**Category:** Support\
**Created:** [October 15, 2026, 5:57pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133 "2026-10-15T17:57:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 15, 2026, 5:57pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/1 "2026-10-15T17:57:29Z")

</div>

I would like to use the threading module in a micropython programme running on a Plasma 2350W controller to implement a simple, continuously running background task but Thoony simply reports" no module named threading" in response to the programme line “import threading”. Should this be possible? I am trying to flash the colon on a 4 digit Sparkfun LED display, independently of whatever else is going on. The programme I am using to see if this could work is:-

import time  
import threading

def colon\_flashing():

while True:  
led.set\_colon(True).draw()  
time.sleep(1)  
led.set\_colon(False).draw()  
time.sleep(1)

thread=threading.Thread(target=colon\_flashing)  
thread.start()

from pimoroni\_i2c import PimoroniI2C

PINS\_PICO\_EXPLORER = {‘sda’: 20, ‘scl’: 21}

i2c = PimoroniI2C(\*\*PINS\_PICO\_EXPLORER)

from ht16k33segment14 import HT16K33Segment14

led = HT16K33Segment14(i2c)

while True:

```auto
#led.set_colon(True).draw()
time.sleep(2)
for x in range (12):
    led.set_brightness(x)
    led.set_character(str(1),0).set_character(str(2),1).draw()
    led.set_character(str(3),2).set_character(str(4),3).draw()
    print(x)
    time.sleep(1)

#led.set_colon(False).draw()

for y in range (16, 0, -1):
    led.set_brightness(y)
    led.set_character(str(1),0).set_character(str(2),1).draw()
    led.set_character(str(3),2).set_character(str(4),3).draw()
  
    time.sleep(1)

```

time.sleep(5)

I feel sure there are other problems with this code but at the moment I can’t get past the “no module named threading”. From what I have gleaned so far micropython should support a threading function. Any help gratefully received.

---

<div class="post-metadata">

**Author:** ![SirFico](https://avatars.discourse-cdn.com/v4/letter/s/bcef8e/32.png) [@SirFico](https://forums.pimoroni.com/u/SirFico)\
**Post date:** [October 15, 2026, 6:35pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/2 "2026-10-15T18:35:20Z")

</div>

Its import \_thread

I expect the \_ is a due warning to be very careful with using a ‘highly experimental’ module :)

> **[\_thread – multithreading support — MicroPython latest documentation](https://docs.micropython.org/en/latest/library/_thread.html#module-_thread)**
>
> This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

And as the doc suggest do make sure you read about the locks _CPython documentation:_ **[`_thread`](https://docs.python.org/3.5/library/_thread.html#module-_thread "(in Python v3.5)")**

Of course its depending on what you are wanting to achieve, but the asyncio module may be a better bet.

---

<div class="post-metadata">

**Author:** ![bablokb](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@bablokb](https://forums.pimoroni.com/u/bablokb)\
**Post date:** [October 15, 2026, 7:15pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/3 "2026-10-15T19:15:56Z")

</div>

Yes, don’t waste your time with threading, follow the advice of @SirFico. asyncio is the way to go. I have done LED animations, music playing, motors all at the “same time” with asyncio and once you understand the concept it is not much different to what you are used to from (traditional) threading.

If you look around this forum, you will find a link to an asyncio introduction that somebody had posted some time ago.

---

<div class="post-metadata">

**Author:** ![frasergj](https://avatars.discourse-cdn.com/v4/letter/f/ed8c4c/32.png) [@frasergj](https://forums.pimoroni.com/u/frasergj)\
**Post date:** [October 17, 2026, 1:20pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/4 "2026-10-17T13:20:32Z")

</div>

I would concur that **asyncio** is the way to go for this.

I’ve got a script running on my Plasma which has one thread handling the update loop for the LEDs, and another one listening on port 80 for commands via HTTP. The latter updates a variable telling the LEDs what pattern to run, with the former loop doing the work.

I got a bit of help from Gemini to get the basic structure how to do it and built on it from there.

Future expansion is to be able to send actual LED colours via the HTTP command too but not done that yet.

---

<div class="post-metadata">

**Author:** ![mickf](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@mickf](https://forums.pimoroni.com/u/mickf)\
**Post date:** [October 19, 2026, 6:44pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/5 "2026-10-19T18:44:09Z")

</div>

Thank you for your help and advice, frasergj, just one question, who or what is “Gemini” from whom you got help?

---

<div class="post-metadata">

**Author:** ![frasergj](https://avatars.discourse-cdn.com/v4/letter/f/ed8c4c/32.png) [@frasergj](https://forums.pimoroni.com/u/frasergj)\
**Post date:** [October 20, 2026, 2:30pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/6 "2026-10-20T14:30:30Z")

</div>

Google Gemini the AI bot, asked for advice on how to implement and it suggested **asyncio** or pinning tasks to specific CPU cores. It recommended the former method though.

---

<div class="post-metadata">

**Author:** ![bablokb](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@bablokb](https://forums.pimoroni.com/u/bablokb)\
**Post date:** [October 21, 2026, 7:50am UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/7 "2026-10-21T07:50:19Z")

</div>

For good reason. Threading is very limited and marked as experimental. It is explicitly not documented in the official MicroPython docs. So do yourself a favor and don’t use it, unless you are a wizard. In contrast, asyncio is very well documented and you will find many examples, tutorials and docs about it.

---

<div class="post-metadata">

**Author:** ![frasergj](https://avatars.discourse-cdn.com/v4/letter/f/ed8c4c/32.png) [@frasergj](https://forums.pimoroni.com/u/frasergj)\
**Post date:** [October 21, 2026, 1:58pm UTC](https://forums.pimoroni.com/t/use-of-threading-module-in-micropython/29133/8 "2026-10-21T13:58:34Z")

</div>

Yeah much better and works really well, you’ve just got to make sure to yield back properly. For simple loops like running LEDs it’s perfectly fine.

Maybe when it matures a bit it might be viable for some workloads but realistically, if asyncio is not sufficient for your needs, the Pico may not be the best choice either.

In any case, the Pico is a tremendous little device!
