Nov-12-2019, 05:49 AM
Hi All,
i'm trying to learn how to write a module, and meet some problem.
Is there any method we can used a variable inside a module, when we are outside the module.
I have two code, one is the module code(input_mod.py), another one is the main code(main_mod.py).
My question is how can i used the name (which is in the module) this variable in main_mod.py.
i used this print(mod.module.name()), doesn't work.
input_mod.py
i'm trying to learn how to write a module, and meet some problem.
Is there any method we can used a variable inside a module, when we are outside the module.
I have two code, one is the module code(input_mod.py), another one is the main code(main_mod.py).
My question is how can i used the name (which is in the module) this variable in main_mod.py.
i used this print(mod.module.name()), doesn't work.
input_mod.py
def module(): name = input ("Please enter your name:") print ("hell0", name) returnmain_mod.py
import input_mod input_mod.module()