Python Forum
Calling functions from other programs
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calling functions from other programs
#1
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)
Reply
#2
(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/a...index.html
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020