I have the following code
__import__('some_module')
And I was wondering if it was possible to do something like this:
__import__('some_module') as some_name
I have the following code
__import__('some_module')
And I was wondering if it was possible to do something like this:
__import__('some_module') as some_name
As you have in the question is not, but you can assign the return of __import__
to a var, eg:
mod_alias = __import__('string')
The equivalent of:
import string as mod_alias
In this case mod_alias
is your alias.