title: SystemError: Parent module '' not loaded, cannot perform relative import
body: <p>I have the following directory:</p>
  
  <pre><code>myProgram
  └── app
      ├── __init__.py
      ├── main.py 
      └── mymodule.py
  </code></pre>
  
  <p>mymodule.py:</p>
  
  <pre><code>class myclass(object):
  
  def __init__(self):
      pass
  
  def myfunc(self):
      print("Hello!")
  </code></pre>
  
  <p>main.py:</p>
  
  <pre><code>from .mymodule import myclass
  
  print("Test")
  testclass = myclass()
  testclass.myfunc()
  </code></pre>
  
  <p>But when I run it, then I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "D:/Users/Myname/Documents/PycharmProjects/myProgram/app/main.py", line 1, in &lt;module&gt;
      from .mymodule import myclass
  SystemError: Parent module '' not loaded, cannot perform relative import
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>from mymodule import myclass
  </code></pre>
  
  <p>But I get no auto completion when I type this in and there is a message: "unresolved reference: mymodule" and "unresolved reference: myclass".
  And in my other project, which I am working on, I get the error: "ImportError: No module named 'mymodule'.</p>
  
  <p>What can I do?</p>