title: Python3 imports changes
body: <p>I have a module that uses enums defined in the same package. I want to run it locally for self testing and also access it from other packages, but I can't get the import for the enum to handle both situations. </p>
  
  <p>I have tried a blank _ _ init _ _.py (without the spaces) in both the sub and the proj directories, with no apparent change. </p>
  
  <p>I have tried variations of python -m without success. </p>
  
  <p>Here is the minimal code that shows my problems:</p>
  
  <pre><code>    /my/proj
          |----sub
          |      |---e1.py
          |      |---one.py
          |      |---two.py
          |-p1.py
          |-p2.py
  
      ----
      $ cat /my/proj/sub/e1.py
      from enum import Enum
      class UsefulEnums(Enum):
          ZERO = 0
  
      ----
      $ cat /my/proj/sub/one.py
      from e1 import UsefulEnums as E
      def profound():
         print('The value of {} is {}'.format(E.ZERO.name, E.ZERO.value))
      if __name__ == '__main__':
         profound()
  
      /my/proj/sub$ python one.py
      The value of ZERO is 0
      ----
      $ cat /my/proj/sub/two.py
      # note the dot before the module name. No other change from one 
      from .e1 import UsefulEnums as E
      def profound():
         print('The value of {} is {}'.format(E.ZERO.name, E.ZERO.value))
      if __name__ == '__main__':
         profound()
  
      /proj/sub$ python two.py 
      Traceback (most recent call last):
        File "two.py", line 1, in &lt;module&gt;
          from .e1 import UsefulEnums as E
      ModuleNotFoundError: No module named '__main__.e1'; '__main__' is not a package
  
      ----
      $ cd /my/proj
      /my/proj$ cat p1.py
      import sub.one as a
      if __name__ == '__main__':
         a.profound()
  
      /my/proj$ python p1.py
      Traceback (most recent call last):
        File "p1.py", line 1, in &lt;module&gt;
          import sub.be1 as a
        File "/home/esmipau/delete_me/proj/sub/one.py", line 1, in &lt;module&gt;
          from e1 import UsefulEnums as E
      ModuleNotFoundError: No module named 'e1'
      ----
      /my/proj$ cat p2.py
      import sub.two as a
      if __name__ == '__main__':
         a.profound()
  
      /my/proj$ python p2.py
      The value of ZERO is 0
  </code></pre>
  
  <p>When run from the 'sub' directory, one.py works as expected, two.py fails with a 'ModuleNotFoundError' error as detailed above.
  When imported in parent code and run from the parent directory, two.py now works, and one.py fails with a different 'ModuleNotFoundError' error. 
  I would like a three.py in the 'sub' directory that uses the enums defined in e1.py, and which can be run locally for self testing etc, and can be included from external module not in the same directory. </p>
  
  <p>--- edit for close as duplicate suggestions --- 
  This is not the same question as others that have been suggested such as <a href="https://stackoverflow.com/questions/51397669/correct-import-and-package-structure-now-that-init-py-is-optional">Correct import and package structure now that __init__.py is optional</a> as I require a way for one module to import another <em>in the same directory</em> regardless of whether the module is being executed locally or imported from another module. </p>