importing module causes TypeError: module.__init__() takes at most 2 arguments (3 given)

前端 未结 4 744
醉梦人生
醉梦人生 2021-01-11 13:45

Please don\'t mark as duplicate, other similar questions did not solve my issue.

This is my setup

/main.py
/actions/ListitAction.py
/actions/ViewAction         


        
4条回答
  •  礼貌的吻别
    2021-01-11 14:41

    If your file is in the root directory of the project then you can directly write the file name and import.

    For example, if filename is Parent1.py and class name is Parent, then you would write

    from Parent1 import Parent
    

    However, if your file Parent1.py is under any folder for example:

    DemoFolder ->  Parent1.py- >    Parent
    (Folder).       (File).      (Class name)
    

    Then you would have to write:

    from Test.Parent1 import Parent
    

提交回复
热议问题