Querying tk-houdini context with Python

Hi there

Is there a way to query the current Shotgun context using python inside Houdini? I’d like to set parameter values according to the current shot/asset and have those values update if the scene is re-saved to a different context.

Regards
David

1 Like

Hi @David_Schneider
To get the current context from a python script running inside Houdini, but not from a Toolkit app you would do something like:

import sgtk

# get the current Shotgun engine instance
engine = sgtk.platform.current_engine()

# get the current engine context.
ctx = engine.context

I’ve not tested that directly in Houdini, but I believe it should work.

Works great! Thanks Philip.

1 Like