I want to import only one or more variables from different files but if I write
in file1:
a=4
print('Hello in file1)
and in file2:
from file1 import a
in the file2 (the second file), the compiler runs the whole code of file1.
Why I can't obtain only the value of a
?
And, there's a way to save in a the value of input and call from file2 the value of a?
There's my idea: file1:
a=input()
and file2:
from file1 import a
print(a)
Is it possible?