Python: Importing an “import file”

后端 未结 2 1438
醉话见心
醉话见心 2020-12-05 14:47

I am importing a lot of different scripts, so at the top of my file it gets cluttered with import statements, i.e.:

from somewhere.fileA import ...
from some         


        
2条回答
  •  长情又很酷
    2020-12-05 15:25

    Of course there is; just create a file called myimports.py in the same directory where your main file is and put your imports there. Then you can simply use from myimports import * in your main script.

提交回复
热议问题