Use variable outside its function

because of global keyword, it is restricting the scope of the variable. Instead of global you can use self and define variable in def __init__()

def __init__(self, parent, controller):
    self.selection_index = '0'

now, instead of using selection_index use self.selection_index

Leave a Comment