Similar questions have been asked many times, but I can't figure out how to solve it when using IntelliJ.
I have a directory like following
package
├── init.py.
├── subpackage1
│ ├── init.py
│ ├── moduleX.py
├── subpackage2
│ ├── init.py
│ ├── moduleY.py
In moduleY
I want import moduleX
using relative import syntax:
from ..subpackage1 import moduleX
and got the following error message:
attempted relative import beyond top-level package
I know this can be solved by changing the working directory to the top of "package", and typing python -m package.subpackage2.moduleY
in the console.
But how can I do it in IntelliJ?