[Solved] Python : How to write class in class


This is not done with nested classes but with composition:

class Tool:
   def __init__(self, target):
       self.target = target
       self.wifi = Wifi(self.target)

class Wifi:
    def __init__(self, target):
        self.target = target

    def connect(self, id):
        print id
        self.target.write("xxxxxxxxx")

    def verify(self)
        pass

if __name__ == '__main__':
    T = Tool(target)
    T.wifi.connect("dev")

1

solved Python : How to write class in class