更新时间:2023-01-08 17:48:31
例如,"Main.py"包括:
txt2cfg.py -inFile -outFile ... ma2lxo.py -inFile -outFile ...
两件事.
每个其他脚本都需要main()函数和"main-import开关".请参见 http://docs.python.org/tutorial/modules. html#executing-modules-as-scripts 以获得有关其外观的提示.
导入并执行其他脚本.
import txt2cfg
import ma2lxo
txt2cfg.main( inFile, outFile )
ma2lxo.main( inFile, outFile )
这是做事的最简单方法.
Here is the problem...
I'm writing very small plugin for Blender, I have 10 python scripts, they parsing different file formats by using command-line, and I have a Main Python script to run all other scripts with proper commands...
for example, "Main.py" include:
txt2cfg.py -inFile -outFile...
ma2lxo.py -inFile -outFile...
Blender already include Python, so I can run "Main.py" from Blender, But I need it to work with both PC and MAC, and also doesn't require Python installation, so I can't use:
because they required Python installation in order to run *.py files.
Sorry for language
Thanks
for example, "Main.py" include:
txt2cfg.py -inFile -outFile... ma2lxo.py -inFile -outFile...
Two things.
Each other script needs a main() function and a "main-import switch". See http://docs.python.org/tutorial/modules.html#executing-modules-as-scripts for hints on how this must look.
Import and execute the other scripts.
import txt2cfg
import ma2lxo
txt2cfg.main( inFile, outFile )
ma2lxo.main( inFile, outFile )
This is the simplest way to do things.