This seems like an incredibly silly problem, but it's doing my nut in. I just started working with Python a few days ago, after spending a while in other languages, and I've run into a very weird problem. I'm attempting to set a top-level string variable called 'word' to the concatenation of itself and a letter. Python is able to find the variable just fine, as demonstrated below.
However, any time I try to concatenate, I suddenly get an error telling me Python is unable to find the variable.
The yellow squiggle is my IDE telling me that the variable can't be found. I've tried literally directly copy+pasting other solutions from other stack-exchange posts. It's a little embarrassing to be having this much trouble with concatenation, but I've tried most of the stuff I can think of.
Edit:Here's my code. As you can see, "word" is initialized at the top of the file:
word_dict = PyDictionary()
repeats = 5
word = "e"
def handle_input(x, y, letter):
word += letter
print(word)
coords = make_coords(x, y)
for list in grid:
for button in list:
button.update(disabled=True)
for coord in coords:
x = coord[0]
y = coord[1]
list = grid[y]
button = list[x]
button.update(disabled=False)