使用主程序公共函数和用户信息
我们可以自定义一个 coms.py文件。
第一种调用方式 将公共函数加载到coms中:
from app.modules import xhook
#加载公共函数到当前程序
xhook.coms.init_apicom(globals())
使用上面函数,coms中就有了所有公共函数。
例如 port_stop(port)方法。
在coms中使用
port_stop(123)
在其他程序文件中使用:
form . import coms
coms.port_stop(123)
第二种方式:
from app.modules import xhook
apicom=xhook.coms.apicom
例如 port_stop(port)方法。
在coms中使用
apicom.port_stop(123)
在其他程序文件中使用:
form . import coms
coms.apicom.port_stop(123)
6