Код: Выделить всё
a/
- dependencies_v1.py (imports helloworld from dependencies_2 in a/)
- dependencies_2.py (implements helloworld function that prints "helloworld from a")
b/
- dependencies_v2.py (imports helloworld from dependencies_2 in b/)
- dependencies_2.py (implements helloworld function that prints "helloworld from b")
- main.py
Вот мой файл main. py:
Код: Выделить всё
from dependencies_v1 import helloworld
helloworld()
import sys
import os
sys.path.insert(0, os.path.abspath('../a'))
from dependencies_v2 import helloworld
helloworld()
Если я закомментирую первые две строки:
< pre class="lang-py Prettyprint-override">
Код: Выделить всё
# from dependencies import helloworld
# helloworld()
import sys
import os
sys.path.insert(0, os.path.abspath('../a'))
print(sys.path)
from dependenciesv import helloworld
helloworld()
Как мне получить main.py для печати "Helloworld из b", а затем «Helloworld из A"? , Я только хочу вносить изменения в main.py и не хочу вносить какие -либо изменения кода в A /.)
Подробнее здесь: https://stackoverflow.com/questions/793 ... iles-in-th
Мобильная версия