Q:

Update a variable from a different class

I have a Python program which has a variable access_token in class1. In the constructor it is set to self.access_token = "".
I want to update it from class2 to the token value. I've tried calss1.access_token = token_value but it remains unchanged. What am I doing wrong?

A:

It sounds like you have hit the usual class vs instance problem.
Assuming class1 and class2 like this:
class class1:
    def __init__(self):
        self.access_token = ""
    # other parts elided

class class2:
    def method(self, other):
        # calculate a token
        token_value =   # details elided
        other.access_token = token_value   # update class1

The usage is like this:
c1 = class1()   # c1 has empty access_token

c2 = class2()   # c2 knows how to create the access_token
c2.method(c1)   # c2 calculates and updates c1

