我有两个脚本。脚本 A 有一堆函数,其中包含变量,需要在脚本 B 中定义。
例如,这基本上是我在脚本 A 和 B 中需要做的
一个.py:
health = {p1:"100", p2:"100"}
脚本的其余部分需要定义该字典。
B.py:
p1 = raw_input()
p2 = raw_input()
from A.py import *
#Here, I get the error that p1 and p2 aren't defined in A.py
#I need to pass p1 and p2 (in B.py) to the health dict in A.py
如何将参数变量传递给导入的脚本?