我正在尝试构建一些python脚本。我在我的主脚本(start.py)中导入了(导入Handler)函数集。在start.py中,我调用其中一个导入的函数从config(dir1)动态导入脚本。我需要在config中导入的一个文件中使用1个函数(消息(self,text),我的主脚本start.py在MyScript(Protocol)类中)。 所以我的目录结构是:
MainDir
start.py (main script)
Handler.py
config.cfg
dir1 (dir with plugins)
HelloWorld.py (this needs to use function from start.py)
你能帮助我吗?
谢谢。
编辑:
Start.py是Twisted TCP服务器,我需要在我的插件中使用一些扭曲的函数。
答案 0 :(得分:1)
以下是两个选项: