I am having hard time trying to move variable around two files.
At first it is defined in file1.py
.
The function using this variable is stored in file2.py
.
In the end the function is called in file1.py
.
As you can see the final result is NameError
. What am I doing wrong?
# file1.py
from file2 import myFunct
x = 1
myFunct()
# file2.py
def myFunct():
test = f'some string {x} some string'
print(test)
# NameError: name 'x' is not defined