What *really* happens when you 'import lib'

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
cnmcdee
Posts: 12
Joined: Sat Sep 11, 2021 10:41 pm

What *really* happens when you 'import lib'

Post by cnmcdee » Wed Sep 22, 2021 11:38 pm

If one does:

Code: Select all

MicroPython v1.17 on 2021-09-02; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> import os
>>> 
>>> 

That executes fine, but would imply that the os library module file would need to already be on the chip no?

If this is the case then why does a os.listdir() not show these library files. How is this actually setup?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: What *really* happens when you 'import lib'

Post by davef » Thu Sep 23, 2021 12:03 am

uos is on the chip.

Code: Select all

help('modules')
show you which modules are on the chip.

Code: Select all

uos.listdir()
show you the programs you have loaded into flash (/pyboard)

Post Reply