I am writing a custom C module for Micropython. I have two questions:
- Is it possible to have submodules?
- Is it possible to define classes?
Frank
Code: Select all
mp_obj_module_t nested = {
.base = { &mp_type_module },
.globals = ...
};
STATIC const mp_rom_map_elem_t mainmodule_globals_table[] = {
...
{ MP_ROM_QSTR(MP_QSTR_nested), MP_ROM_PTR(&nested) },
}
...
Code: Select all
mainmodule\
__init__.py
nested.py
Code: Select all
mypackage
├── __init__.py
├── one.py # contains "import two"
└── two
├── __init__.py
├── two.py # contains "import three"
└── three
├── __init__.py
└── three.py
Code: Select all
import mypackage.one
import mypackage.one.two
import mypackage.one.two.three