Importing classes from different files in a subdirectory

前端 未结 5 1292
深忆病人
深忆病人 2020-11-29 07:21

Here\'s the structure I\'m working with:

directory/
          script.py
          subdir/
                 __init__.py
                 myclass01.py
                 


        
5条回答
  •  借酒劲吻你
    2020-11-29 07:54

    from subdir.* import *
    

    You can not use '*' this way directly after the 'from' statement. You need explict imports. Please check with the Python documentation on imports and packages.

提交回复
热议问题