Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 449
Lanfear Avatar asked Apr 30 '14 11:04

Lanfear


Video Answer


1 Answers

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

like image 151
SimonPJ Avatar answered Oct 17 '22 09:10

SimonPJ