[Solved] one self for class in class


You only defined classes inside the namespace of class User. An instance of User don’t have magically instances of the inner classes (i.e. in Python there is nothing like a inner class). So class definitions inside other classes in normally not useful.

You have to give the other classes an explicit reference to your user object:

class User(object):
     def __init__(self)
         self.user_session = Session()
         self.action = Action(self)
         self.listing = Listing(self)

     def wallet_sum(self):
         self.user_session.get('current wallet sum')

 class Action(object):
     def __init__(self, user):
         self.user_session = user.user_session 

     def buy_dog(self):
         self.user_session.post('buy_dog')

 class Listing(object)
     def __init__(self, user):
         self.user = user

     def my_dogs(self):
         self.user.user_session.get('all_my_dogs')

user = User()
user.action.buy_dog()
user.listing.my_dogs()

1

solved one self for class in class