Код: Выделить всё
# __init__.py
import sys
sys.path.append("path of the third party module")
from .file_in_the_package import ... # the file rely on the third party module
Код: Выделить всё
# separated file imp.py
import sys
sys.path.append("path of the third party module")
Код: Выделить всё
# changed __init__.py
import imp
from .file_in_the_package import ... # the file rely on the third party module
Теперь мне просто интересно, в какой ситуации изменился sys.path< /code> будет передан при импорте файл/пакет с sys.path изменился?
Подробнее здесь: https://stackoverflow.com/questions/792 ... ile-or-pac
Мобильная версия