Jupyter - Import Custom Mojo Modules?
How can we import and use a custom Mojo module from a Jupyter notebook? I added details of what I've tried so far by replying to an existing post started by @hogepodge. Thanks!
Here's a link to that post: https://discord.com/channels/1087530497313357884/1119100298456215572/1198684128091058198
2 Replies
So I think I have some VS Code weirdness going on, and maybe an issue with Mojo version
0.6.1
. With the Jupyter notebook open, VS Code highlighted the import statement saying it was unable to locate module 'my_name'
, so I prefixed it with the current folder shared.my_name
which made the type checker happy but gave an error when I tried to run the Mojo code. I removed the extra shared.
and it now runs as expected.
Perhaps also important...I updated to Mojo version 0.6.3
Hope this helps anyone else trying to import custom modules in a Jupyter notebook.
Cheers...EzRyder
Edit: In VS Code, I found that I needed to restart the kernel in order for changes in a Mojo module to propagate into the open Jupyter file.
Module: my_name.mojo
Jupyter
Output:
Hi Bob!
Congrats @EzRyder, you just advanced to level 2!