'How do I run ipython code via %edit magic?

I am iteratively developing an ipython script that I will reuse in future.

I used %%writefile test.ipy after experimenting with shell execution line magic !.

But when I subsequently exit %edit test.ipy iPython returns an error because it was expecting purely python code rather than the ipython statements in test.ipy.

Can I tell %edit% to execute ipython on exit rather than python?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source