I want to import a function from another file in the same directory.
Sometimes it works for me with from .mymodule import myfunction but sometimes I get
from .mymodule import myfunction
If none of the above worked for you, you can specify the module explicitly.
Directory:
├── Project │ ├── Dir │ │ ├── __init__.py │ │ ├── module.py │ │ └── standalone.py
Solution:
#in standalone.py from Project.Dir.module import ...
module - the module to be imported