In the ipython notebook, I would like to programatically read and execute code cells from within a code cell itself.
Something like
if condition:
# run input cell no. 3
I found a solution here, the function execute_notebook
reads an ipynb
file cell by cell and executes code cells using get_ipython().run_cell()
.
Is there a way to do the same, i.e. without reading the cells from the an external ipynb
file first? Is there a way to write macros, to reference and access code cells from within an ipython notebook?