title: Python - Import module based on string then pass arguments
body: <p>Ive searched the web and this site and cant find an answer to this problem. Im sure its right in front of me somewhere but cant find it.</p>
  
  <p>I need to be able to import a module based on a string. Then execute a function within that module while passing arguments.</p>
  
  <p>I can import based on the string and then execute using eval() but I know this is not the best way to handle this. I also cant seem to pass arguments that way.</p>
  
  <p>My current module that would be set based on a string is named TestAction.py and lives in a folder called Tasks.
  This is the content of TestAction.py:</p>
  
  <pre><code>def doSomething(var):
      print var
  </code></pre>
  
  <p>This is the code I am executing to import TestAction and execute. </p>
  
  <pre><code>module = "Tasks.TestAction"
  import Tasks
  mymod = __import__(module)
  eval(module + ".doSomething()")
  </code></pre>
  
  <p>How can I make this code #1 not use <code>eval()</code> and #2 pass the var argument to <code>doSomething()</code>?</p>
  
  <p>Thanks in advance!</p>