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


Messages In This Thread
Calling functions from other programs - by kgchin - Jul-18-2018, 11:43 PM

Forum Jump:

User Panel Messages

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