Не удается выполнить импорт из подпапки в пакете python - PullRequest
1 голос
/ 23 января 2020

У меня есть проект


B/
|---C/
|---|---setup.py [with name=G.H.C]
|---|---G/
|---|---|---H/
|---|---|---|---C/
|---|---|---|---|---__init__.py
|---|---|---|---|---code.py
|---D/
|---|---setup.py [with name=G.H.D]
|---|---G/
|---|---|---H/
|---|---|---|---D/
|---|---|---|---|---__init__.py
|---|---|---|---|---main.py
|---|---|---|---|---samelevelasmain.py
|---|---|---|---|---E/
|---|---|---|---|---|---notsamelevelasmain.py

main.py выглядит как

from G.H.C.code import func1 [linter recognises this]
from G.H.D.samelevelasmain import func2 [linter recognises this]
from G.H.D.E.notsamelevelasmain import func3 [linter does not recognise this]

Я пошел в каталоги C и D и запустил pip install . и подтвердил с помощью pip list что они были в моем окружении. Почему линтер не распознает GHDE?

Я пробовал __init__.py в E. Без кубиков. Похоже на это

Python3

...