I don't know if this has already been brought up, but I've been working on creating a tool to flash my esp projects to my microcontroller, and I just realized that there are no relative imports in micropython. It would seem that micropython treats all import statements as absolute from the root directory, and not from the directory that the file is located, for example:
If I have a project set up like this:
Code: Select all
myproj
|-> main.py
|-> libs
|-> display.py
|-> ssd1306.py
Then in display when I want to use the ssd1306.py I have to do an absolute import like:
instead of
Code: Select all
import ssd1306
# or
import .ssd1306
like I would normally.
Is there plans to implement something like this in the future? I'm planning on sharing my project deployment script, and and knowing the answer will determine how much of an overhaul I'll need to do.