You've not provided all of the code, but the problem may be that get_user()
is setting some_user
as an instance attribute somewhere, as in self.some_user = foo
.
This will only set some_user
for that specific instance of User
however (so for Bob, Lisa, Beto, User53, etc.), but not for the User
class itself. When accessing some_user
with self
, as in self.some_user
, you set it for the specific instance that's executing those statements, not the class. In updating()
you're accessing the class attribute User.some_user
, not a specific instance attribute like usr53.some_user
. In order to update the class attribute, invariant by default for all instances of User
, you ought to be setting it with User.some_user = foo
in get_user()
.
Right now in path = "/posts/" + User.some_user
, it's trying to access the class attribute which may never have been set. Because nested classes like UpdatingUser
can't access the instances of the nesting class (User
) that they're called from, UpdatingUser
won't be able to access any some_user
set with self
or any other instance attributes of User
. So the solution would be to have get_user()
set the class attribute instead of the instance attribute as described in the previous paragraph.