Search code examples
pythonreloadinterpreter

Is it possible to reload a python module as something?


Messing around in the interpreter, it would be useful for me to be able to do something along the lines of reload(foo) as f, though I know it is not possible. Just like I do import foo as f, is there a way to do it?

Using Python 2.6

Thanks!


Solution

  • If you import as import foo as f in the first place, then the reload call can be reload(f)