Calling functions from other programs - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Calling functions from other programs (/thread-11632.html) |
Calling functions from other programs - kgchin - Jul-18-2018 Hi, I am trying to run a Python script that calls the optimization program Hypermesh. This program uses scripts and functions in tcl that we are using to automate the optimization process. Is there a way to pass information from Python to these tcl functions? Below is the Python code I have been using. Thanks, Kaitlyn import subprocess import os #Save file names as variables hmPath=r"C:\Program Files\Altair\2017\hm\bin\win64\hmopengl.exe" scriptName=r"C:\Users\Kaitlyn\Documents\PythonREU\createMaterial.tcl" input = 100 #Runs tcl script in Hypermesh callScript='"{0}" -tcl "{1}"'.format(hmPath,scriptName) subprocess.call(callScript) #How I attempt to run tcl function with inputs from Python in Hypermesh callScript='"{0}" -tcl "{1}" {2}'.format(hmPath,scriptName,input) subprocess.call(callScript) RE: Calling functions from other programs - micseydel - Jul-18-2018 (Jul-18-2018, 11:43 PM)kgchin Wrote: Is there a way to pass information from Python to these tcl functions?Your question seems more like a tcl one than a Python one, so as a headsup you may find our usefulness run out at some point, but in the mean time it looks like yes, just like sys.argv in Python, tcl has a way to use command line arguments - http://www.fundza.com/tcl/script_shell/arguments/index.html |