title: Cannot import module in same directory and package
body: <p>I'm using a <code>from . import module</code> statement to do exactly that: import a local module to my script. The script and module reside in the same folder.</p>
  
  <pre><code># module.py
  def foo():
      print('Foo!')
  
  # script.py
  from . import module
  module.foo()
  
  &gt; ImportError: cannot import name 'module'
  </code></pre>
  
  <p>This should be pretty easy, and doing just <code>import module</code> does work, but as <a href="https://stackoverflow.com/a/39746026/7089239">this answer</a> suggests one should, I modified the statements to the former form.</p>
  
  <p><strong>The end goal</strong> is to have a package, from which I can use things, but also to have executable scripts inside the package that import other parts of that package. Apparently, after a few days worth of searching and a few questions I still don't quite understand the import and packaging machinery.</p>
  
  <p>These might be the cause:</p>
  
  <ul>
  <li>Import statements are different in 2.7 and 3.x, I'm using 3.6, the question was on 2.7</li>
  <li>Relative imports are different inside packages (folder with <code>__init__.py</code>)</li>
  <li>The working directory is different or the folders are not in <code>sys.path</code></li>
  </ul>
  
  <p>Having an <code>__init__</code> file does not make a difference at least in a fresh project in PyCharm. Also, the working directory is set to the folder of the sources and it is in <code>path</code>.</p>
  
  <p>Have I missed something? Or rather, <strong>what's the correct way of achieving the functionality described in the end goal?</strong> Any help is greatly appreciated!</p>