如何在另一个脚本中运行一个脚本? [英] How to run a script within another script?
本文介绍了如何在另一个脚本中运行一个脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我想在另一个脚本中运行一个脚本 但是第二个脚本在不同的路径中. 我该怎么做
我在 macOS Catalina 上使用 tkinter 和 Python 3.7.1.谢谢!
I'm using tkinter and Python 3.7.1 on macOS Catalina. Thanks!
推荐答案
您基本上是从其他脚本导入类/函数.例如:
You basically import the class/function from the other script. For example:
from other_script import a_class
现在,确保您在另一个脚本的同一目录中打开 IDLE,以便您可以导入它.
Now, make sure you open your IDLE in the same directory of the other script so you can import it.
这篇关于如何在另一个脚本中运行一个脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文