In Python, can I define an alias for an imported module?
For example:
import a_ridiculously_long_module_name
... so it has the alias "short_name".
import a_ridiculously_long_module_name as short_name
also works for
import module.submodule.subsubmodule as short_name
Check here
import module as name
or
from relative_module import identifier as name
If you have done:
import long_module_name
you can also give it an alias:
lmn = long_module_name
There is no reason to do this in code, but sometimes I find it useful in an interactive interpreter.