Replicate Loader behavior in background


In Nuke, we currently have an in-house tool that finds all plates for a given shot and create a read for each.

I would like to update this tool since, now, in our Pipeline, all the required infos are now published in Shotgun.
When thinking about it, I want to replicate exactly the Shotgun Loader behavior but in background. This way, scene breakdown will also work.

So my question is: is there a way to trigger Shotgun loader without calling the gui?
For exemple, for the current context load last version of published file for a given template?

I know how to do this trough python outside of Shotgun Loader but then I won’t have a functional “Scene Breakdown”…

Basically, I want to achieve this:

engine = sgtk.platform.current_engine()
loader_app = engine.apps.get[“tk-multi-loader2”]
selected = loader_app.open_publish(“Select Geometry Cache”, “Select”, [“Alembic Cache”])
print selected

But without any user intervention to select


1 Like


Unfortunately we do not support using the loader programmatically. With that being said, the import/reference logic that manipulates the scene are inside the hooks, not the app itself, so in theory you could call the hooks directly and pass in the properly formatted publish data. The hooks interface are the only thing we pretty much guarantee, since breaking that interface would break everyone’s hook, so calling them directly would work.

It’s certainly not clean, I would not recommend that you do this, but hey, crazier things have happened. My approach would be to wrap around that functionality into a nice little API that I would then invoke at will and maintain easily. It would require a fork of the app, that’s for sure.



OK. I’ll go with the nice little API solution. Thank you JF!