from os import system as sh def vim(fname): sh('vim ' + fname)
Possible way (re) to load a module:
import imp from os import system as sh def _vim(fname, globs): sh('vim ' + fname) (dirname, _, basename) = fname.rpartition('/') modname = basename.rpartition('.')[0] m = imp.load_source(modname, fname) globs[modname] = m
and at any time when you import this into the interpreter, it is recommended to make the shell manually:
def vim(fname): _vim(fname, globals())
because globals() , called in a python file, contains file globals, not an interpreter. I know this is not elegant. But I would recommend reloading the module manually, like reload(modname) , it gives you more control, although it can be tedious.
source share