Call a function from another file?

前端 未结 17 2602
梦谈多话
梦谈多话 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条回答
  •  耶瑟儿~
    2020-11-22 08:57

    in my main script detectiveROB.py file i need call passGen function which generate password hash and that functions is under modules\passwordGen.py

    The quickest and easiest solution for me is

    Below is my directory structure

    So in detectiveROB.py i have import my function with below syntax

    from modules.passwordGen import passGen

提交回复
热议问题