I have a set of Jupyter notebooks, all of which need the same lines of code to initialize. The initialization contains:
%matplotlib inline and %load_ext autoreload) I am looking for a good way to put this code into a module that can be imported and ideally called with something like:
import preamble
preamble.run()
For the initialization code it is easy to do, but what about the module imports and magic commands?
You may instead use a jupyter notebook for that.
Simply put all your code into preamble.ipynb and run it in your first cell with:
%run ./preamble.ipynb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With