【发布时间】:2022-01-17 23:25:13
【问题描述】:
我是 Python 新手。我需要创建项目结构,我需要在我的 TestProj 目录的 main.py 文件中调用包文件。请告诉我如何调用 main.py 中的函数 f1() 和 f2()?
/scratch/testuser/ProjectDir
|
|- TestProjDir
|- main.py
(call f1() from mod_script1.py & f2() from mod_script2.py) here..
|
|- PKG_MODULES_Dir
|- __init__.py
|- mod_script1.py
def f1():
print("This is my f1 func from script1")
|- mod_script2.py
def f2():
print("This is my f2 func from script2")
【问题讨论】:
标签: python-3.x python-2.7