ModularM
Modular3y ago
7 replies
moosems_yeehaw

Module loading error

I have a module with a following file structure as shown in the attached images.

In the types folder there is an __init__.mojo file that imports the main type/function in the submodules for pretty importing by the user. The submodules similarly contain an _init_.mojo that imports the associated type/function so the main init can also cleanly import said type/function. This, however, is an issue according to Mojo.

Attempting to compile this gives the following issue:
types/__init__.mojo:1:6: error: unable to locate module 'array'
from array import Array
     ^
mojo: error: failed to parse the provided Mojo
Screen_Shot_2023-09-19_at_10.43.20_AM.png
Screen_Shot_2023-09-19_at_10.41.34_AM.png
Was this page helpful?