0

Currently, I write pythons files in Vim, and run it with jupyter qtconsole. The advantage of this way is that I could work with Vim so get all the benefits of Vim.

I could run the python directly in Vim using the pymode plugins, but in this way I cannot see and manipulate the output variables, and the figures are opened in another window which is quite annoying when I have to close them to make Vim responsible again. Compared with this, in jupyter qtconsole I could use %maplotlib inline to display figures elegantly.

However, my current workflow has a big disadvantage that every time I run my python script in qtconsole, and then I edit my python script, it is not so easy to run it again with the modified script. Since the module has been loaded, rerun it will not automatically reload the modified module source. I found no easy way to overcome this drawback. Currently I have to restart the kernel and then reset the path, turn on %matplotlib inline, and %run python-script.py again.

Any one can give me a solution?

archerC
  • 81
  • 1
  • 2
  • //every time I run my python script in qtconsole, and then I edit my python script, it is not so easy to run it again with the modified script. Since the module has been loaded, rerun it will not automatically reload the modified module source// what do you want to be done? – SibiCoder May 30 '16 at 15:41
  • I want the modified script run again easily. The problem is that it runs an old cached version unless I restarted the kernel which is painful to reinitialize the environment. Just as in MATLAB, I can simply run the script again, all modifications take place as long as file was saved. – archerC May 30 '16 at 15:56

1 Answers1

0

I find an answer which solves my problem by using ipython extension autoreload.

%load_ext autoreload
%autoreload 2

Then I do not have to restart kernel any more.

Community
  • 1
  • 1
archerC
  • 81
  • 1
  • 2