raganmd
3/28/2018 - 7:33 PM

A TouchDesigner snippet for looking at how to start another touch process.

A TouchDesigner snippet for looking at how to start another touch process.

# matthew ragan | matthewragan.com

import os
import subprocess

# we need to know the location of our app
app                     = "{}/TouchDesigner099.exe".format(app.binFolder)

# we also need to know the location of our file
file                    = "{}/other-process.toe".format(project.folder)

# we're going to set an environment variable for fun
os.environ['ROLE']      = "render1"

# we can start the process with a Popen() call
app_process             = subprocess.Popen([app, file])

# next we can find our process ID
app_id                  = app_process.pid

# to make this a little easier to quit our process we'll 
# put some of these things into storage for later access
other_app       = {
    "app_process"       : app_process,
    "app_id"            : app_id
}

parent().store('other_app', other_app)