Is it possible to reload a python module as something?

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


Python 3 Answer

As others have said, just reload using the name you used as an alias. However, since imp is deprecated in Python 3, you should now do this with importlib. Let's say your original import used an alias as follows:

import fullLibName as aliasName

Then to reload the alias:

importlib.reload(aliasName)

Or (more standard usage):

from importlib import reload
...
reload(aliasName)