I have the following directory:
myProgram βββ app βββ __init__.py βββ main.py βββ mymodule.py
mymodule.py:
class myclass(object): def __init__(self): pass def myfunc(self): print("Hello!")
main.py:
from .mymodule import myclass print("Test") testclass = myclass() testclass.myfunc()
But when I compile it, I get this error:
Traceback (most recent call last): File "D:/Users/Myname/Documents/PycharmProjects/myProgram/app/main.py", line 1, in <module> from .mymodule import myclass SystemError: Parent module '' not loaded, cannot perform relative import
It works:
from mymodule import myclass
But I donβt get automatic completion when I type this message and the message appears: "unresolved link: mymodule" and "unresolved link: myclass" And in my other project I'm working on, I get the error message: "ImportError: there is no module with named "mymodule"
What can I do?
phez1 Nov 20 '15 at 23:23 2015-11-20 23:23
source share