hi,<div><br></div><div>i'm giving a tutorial on monday and realized that at a certain stage of my tutorial i will have to jump out of the notebook to create a file and define a function and then continue in the notebook running the file with 'run'. (the reason is that the inspect module needs to find the function, so i can't simply define it in a separate cell).</div>

<div><br></div><div>for now i can do something like the following to save the contents of a cell:</div><div><br></div><div>---</div><div>with open('test.py', 'wt') as fp:</div><div>    fp.writelines(_i1)</div>

<div><br></div><div>new cell:</div><div>   run test.py</div><div>---</div><div><br></div><div>some questions regarding this approach:</div><div><br></div><div>- is there already some quicker way to achieve this?</div><div>

- instead of _iX, could i use some variable to indicate the previous spatial located cell?</div><div>- is there a way i can load a py file into a cell?</div><div><br></div><div>this allows me to essentially use the notebook from an remote browser (kind of like an ide). especially give codemirror's capabilities, i can do a lot!</div>

<div><br clear="all">cheers,<br><br>satra<br><br>
</div>