you shoudl be able to do %edit filename.py
and %run filename.py
. The non blocking behavior is expected, and IIRC due to technical reason. Not unsurmountable but difficult.
You could define your own magic if you wish, improvement are welcomed.
Hope we can %edit macros soon, that would do well enough to make it work.
For that too, PR are welcomed. I guess as a workaround/option you can %load macro
which would put macro on input n+1 , edit it and redefine it, that might be a good extension for a cell magic %%macro macroname