title: Importing a module dynamically using imp
body: <p>I am trying to import a module from a different directory dynamically. I am following an answer from <a href="https://stackoverflow.com/questions/279237/python-import-a-module-from-a-folder">this question</a>. I have a module named bar in a directory named foo. The main script will be running in the parent directory to foo. </p>
  
  <p>Here is the code i have thus far in my test script (which is running in the parent directory to foo)</p>
  
  <pre><code>#test.py
  import imp
  
  mod = imp.load_source("bar","./foo")
  </code></pre>
  
  <p>and code for bar.py</p>
  
  <pre><code>#bar.py
  class bar:
  
      def __init__(self):
            print "HELLO WORLD"
  </code></pre>
  
  <p>But when i run test.py I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Documents and Settings\user\Desktop\RBR\test.py", line 3, in &lt;module&gt;
      mod = imp.load_source("bar","./foo")
  IOError: [Errno 13] Permission denied
  </code></pre>