title: Dynamic module import of class list from module given its full path
body: <p>First, it seems proper to me to state that I've read over the following questions: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/3027091/python-imports-by-folder-module">Python imports by folder module</a></li>
  <li><a href="https://stackoverflow.com/questions/301134/dynamic-module-import-in-python">Dynamic module import in Python</a></li>
  </ul>
  
  <p>And, I don't feel like they address my use case.  That said, here's my question:  </p>
  
  <p><strong>How can I dynamically import from a configuration file like this:</strong></p>
  
  <pre><code>[imports]
  /var/imports/foo.py = baz monkey
  /var/imports/bar.py = ape
  </code></pre>
  
  <p>So that I can call the known objects via RESTful interface like this.</p>
  
  <pre><code># http://localhost/data?operation=get&amp;class=baz&amp;id=1
  def handler(object):
    def handle(self):
      cls = instantiate(request.args["class"])
      meth = request.args["operation"]
      return getattr(cls,meth,request.args)
  </code></pre>
  
  <p>And it could respond with the result of get() on an instance of that class.  </p>