I have this segment of python code. I want to have a global variable called filetext. However, it does not work as intended, I want to modify the filetext variable in the first method and then use this in the second method.
filetext = "x"
def method1():
filetext = "heyeeh"
def method2():
print(filetext)
This yields "x". How come, and how can I overcome this?