title: Importing files in Python?
body: <p>How do I import Python files during execution?</p>
  
  <p>I have created 3 file <code>a.py</code>,<code>b.py</code> and <code>c.py</code> in a path <code>C:\Users\qksr\Desktop\Samples</code></p>
  
  <p>The files contain the code as shown below:</p>
  
  <p><strong>a.py</strong></p>
  
  <pre><code>from c import MyGlobals
  
  def func2():
      print MyGlobals.x
      MyGlobals.x = 2
  </code></pre>
  
  <p><strong>b.py</strong></p>
  
  <pre><code>import a
  from c import MyGlobals
  
  def func1():
      MyGlobals.x = 1      
  
  if __name__ == "__main__":
      print MyGlobals.x
      func1()
      print MyGlobals.x
      a.func2()
      print MyGlobals.x
  </code></pre>
  
  <p><strong>c.py</strong></p>
  
  <pre><code>class MyGlobals(object):
      x = 0
  </code></pre>
  
  <p>When I execute the code b.py the following error is thrown:</p>
  
  <pre><code>ImportError: No module named a
  </code></pre>
  
  <p>I believe my working directory is default and all the file a,b,c is just created by me in the samples folder.  </p>
  
  <p>How do I import python files in Python?</p>