I'm currently new to python and I'm using micro python. I'm trying to use my custom module however, python can't seem to find it. The file is in the same directory. I've attached 2 images with the code. I don't see why it might not work.
Asked
Active
Viewed 293 times
2 Answers
1
Is controller.py
in the same folder as main.py
?
If controller.py
is in another folder where your main.py
is, you need to import it like this:
import the_folder_has_this_file.controller

Toby Cm
- 136
- 6
-
-
-
1Make sure your modules are actually being uploaded and saved to the Pico's flash. The IDE appears to be running the content of the editor, it may not be uploading and saving the files in the other tabs. – Russ Hughes Jun 13 '22 at 01:56
-
https://stackoverflow.com/questions/72545880/importerror-no-module-named-sdcard – Russ Hughes Jun 13 '22 at 02:09
0
Did you initialise your code as a package (e.g., have an __init__.py
file in the same directory)?
If so you might need to locally install it with a setup.py
file and the command pip install -e .

Marten Scheuck
- 41
- 1
- 5