title: Importing same name file from different directory in python?
body: <p>I have a directory structure like -</p>
  
  <ul>
  <li>D
  
  <ul>
  <li>dir1
  
  <ul>
  <li>filetoimport.py</li>
  </ul></li>
  <li>dir2
  
  <ul>
  <li>filetoimport.py</li>
  <li>run.py</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Filetoimport.py code-</p>
  
  <pre><code>call_function()
      do_something
      return
  </code></pre>
  
  <p>Run.py has -</p>
  
  <pre><code>import filetoimport
  filetoimport.call_function()
  </code></pre>
  
  <p>the dir2 is essentially a copy of dir1 with some changes but run.py is still calling filetoimport from dir1. I don't get what am I missing here?</p>
  
  <p>EDIT 1- dir1 and dir2 are not packages but just plain directories. </p>