Python: Load module by its name
Question: I'm working on a django project that serves multiple sites; depending on the
site I want to import different functionality from a different module; how do
I import a module in Python if I have the name of its package and the module
name itself as a string?


Answer: in Python generally, you can use `__import__` builtin function or `imp` module
features:

    
    
    >>> sys1 = __import__("sys")
    >>> import imp
    >>> sys2 = imp.load_module("sys2", *imp.find_module("sys"))
    >>> import sys
    >>> sys is sys1 is sys2
    True
    

