我创建了两个模块1)主2)备用
我想访问局部变量-name
,该变量存在于主模块功能的功能内的备用模块中
主模块:
from spare import *
def main():
spare() #executing function here so variable can generate
print('Hello',name) #which is in spare module's function
备用模块:
def spare():
name=input("Enter your name")