examples icon indicating copy to clipboard operation
examples copied to clipboard

Possible example of how to import code from other notebook

Open gneusch opened this issue 4 years ago • 1 comments

Hello, Thank you very much for your work, enthusiasm and effort! Could you please add an example, how it is possible to import an object from another Jupyter Notebook? If it is possible at all. I tried: from OtherNotebook import MyObject._ But from is not a valid keyword, and I can't find any other possible keyword, that can do this trick. Thanks a lot in advance! Lori

gneusch avatar Jun 30 '20 14:06 gneusch

@gneusch Importing a notebook from another one isn't possible at the moment. Ammonite, that almond relies on, allows importing other scripts, so that you can import Ammonite scripts (*.sc files) from notebooks. We would need to have Ammonite understand *.ipynb files too, in order to allow importing notebooks. It's not supported for now.

Maybe this could be added directly in Ammonite, or we could have Ammonite accept some kind of hooks, so that other formats could be supported, and almond could add the right hooks for *.ipynb files.

alexarchambault avatar Jun 30 '20 17:06 alexarchambault