Relative Importe in Python 3Python

Python-Programme
Anonymous
 Relative Importe in Python 3

Post by Anonymous »

Ich möchte eine Funktion aus einer anderen Datei im selben Verzeichnis importieren.from .mymodule import myfunction
< /code>
from mymodule import myfunction
< /code>
...but the other one gives me one of these errors:
ImportError: attempted relative import with no known parent package
< /code>
ModuleNotFoundError: No module named 'mymodule'
< /code>
SystemError: Parent module '' not loaded, cannot perform relative import
< /code>
Why is this?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post