__import__ in Python
·2 mins
It’s known that Python’s import statement is implemented by __import__ function. In general, if we want to import a module dynamically, we can use import_module function, which is a wrapper around __import__.
The most important difference between these two functions is that import_module() returns the specified package or module (e.