Call a function from another file?

前端 未结 17 2746
梦谈多话
梦谈多话 2020-11-22 08:06

Set_up: I have a .py file for each function I need to use in a program.

In this program, I need to call the function from the external files.

I\'ve tried:

17条回答
  •  猫巷女王i
    2020-11-22 09:10

    You don't have to add file.py.

    Just keep the file in the same location with the file from where you want to import it. Then just import your functions:

    from file import a, b
    

提交回复
热议问题