Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我编写了一类静态方法,作为AutoKey API 的补充。我想将这些包含在我在自动键编辑器中编写的脚本中,但由于我对 python 的经验仍然有限,我还不能完全弄清楚。
我在哪里放置我的 class-name.py 文件才能将其导入自动键?
您只需将要与 autokey 一起使用的所有 python 模块存储在同一文件夹下,然后选择该文件夹作为User Module Folderin Preferences -> Script Engine。
User Module Folder
Preferences -> Script Engine
例如,在下图中,我设置~/autokey了我的辅助模块可用的目录:
~/autokey
注意:评论中关于更改PYTHONPATH/的建议sys.path也是正确的。User Module Folder配置基本上会附加您选择的文件夹,以sys.path使用户模块可用于您的自动键脚本。
PYTHONPATH
sys.path