title: Python module and package having the same name
body: <p>Below is an example of my project.</p>
  <p>When running <em>foo.py</em> I get:</p>
  <blockquote>
  <p>ModuleNotFoundError: No module named 'foo.bar'; 'foo' is not a package</p>
  </blockquote>
  <p>Renaming the <code>foo/</code> directory or the <code>foo.py</code> file solves the problem, but I'd love to know if there is another way and why this is happening?</p>
  <pre><code>project/
          |
          foo/
          |  __init__.py
          |  foo.py
          |  bar.py
          |
          setup.py
  </code></pre>
  <blockquote>
  <p>In foo.py</p>
  </blockquote>
  <pre><code>import foo.bar
  
      if __name__=='__main__':
         pass
  </code></pre>