title: ValueError: Attempted relative import in non-package not for tests package
body: <p>I know this has been asked many times but somehow I am not able to get over this error. Here is my directory structure-</p>
  
  <pre><code>project/
    pkg/
    __init__.py
    subpackage1/
          script1.py
          __init__.py
    subpackage2/
          script2.py
         __init__.py
  </code></pre>
  
  <p>script2.py has:</p>
  
  <pre><code>class myclass:
      def myfunction:
  </code></pre>
  
  <p>script1.py has</p>
  
  <pre><code> from ..subpackage2 import script2   
  </code></pre>
  
  <p>I also tried</p>
  
  <pre><code>from ..subpackage2 import myclass
  </code></pre>
  
  <p>And this gives me : ValueError: Attempted relative import in non-package</p>
  
  <p>Any help would be really appreciated.              </p>