简体   繁体   English

暂停Python插件模块

[英]Pause plugin module Python

My script uses "plugins" that i have made out of other scripts one uses Pyttsx. 我的脚本使用了我使用其他脚本编写的“插件”,其中一个使用了Pyttsx。 If i used the sleep function in that script nothing else will continue until sleep is over. 如果我在该脚本中使用了睡眠功能,则直到睡眠结束之前,其他所有操作都不会继续。

Is there a way to make only that module sleep and rest keep running ? 有没有一种方法可以使该模块只保持睡眠状态并保持运行状态?

cheers 干杯

Shaggs 肖格斯

You can put plugins in another thread and sleep. 您可以将插件放在另一个线程中并入睡。 Anything in the main process will not be affected by the thread. 主进程中的任何内容都不会受到线程的影响。 Here is instruction for thread in Python. 这是Python中线程的指令。 Hope it helps. 希望能帮助到你。

https://docs.python.org/2/library/threading.html https://docs.python.org/2/library/threading.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM