TypeError: 'module' object is not callable

前端 未结 11 1898
耶瑟儿~
耶瑟儿~ 2020-11-22 12:06
File \"C:\\Users\\Administrator\\Documents\\Mibot\\oops\\blinkserv.py\", line 82, in __init__
    self.serv = socket(AF_INET,SOCK_STREAM)
TypeError: \'module\' objec         


        
11条回答
  •  星月不相逢
    2020-11-22 12:11

    Add to the main __init__.py in YourClassParentDir, e.g.:

    from .YourClass import YourClass
    

    Then, you will have an instance of your class ready when you import it into another script:

    from YourClassParentDir import YourClass
    

提交回复
热议问题