title: How is calling module and function by string handled in python?
body: <p><a href="https://stackoverflow.com/q/3061">Calling a function of a module from a string with the function&#39;s name in Python</a> shows us how to call a function by using getattr("<strong>bar</strong>")(), but this assumes that we have the module <strong>foo</strong> imported already.</p>
  
  <p>How would would we then go about calling for the execution of <strong>"foo.bar"</strong> assuming that we probably also have to perform the import of <strong>foo</strong> (or from <strong>bar</strong> import <strong>foo</strong>)?</p>