so here is the thing i have
i have two script script1.py and script2.py
script1.py main idea is two gather the user's inputs via the input function, assining it to variables and calling the execution of script2.py. here is an example of script1.py:
a = input('enter value a - ')b = input('enter value b - ')c = input('enter value c - ')with open('script2.py) as script2: exec(script2.read())script2.py task is to import these input variables from script1.py, combine them into value and print it. the example of the code for script2.py is provided below.
from script1 import a, b, ctotal_value = a + b + cprint(total_value)whenever i run script1.py shown above it asks me to input value a, b, c two times in a row and then it prints the total_value two times as well.
here is the output of script1.py
enter value a - 1enter value b - 2enter value c - 3enter value a - 1enter value b - 2enter value c - 3123123
i don't understand why script1.py is asking to provide inputs one more time when it was previously mentioned. is it because i'm calling the script2.py and it requires these values to operate?
anyway, how do i go about this and make it so it asks for input only one time and preferably prints the total_value only one time?