How to get current pipeline step in config

Hello!

How can I get the current pipeline step name in a hook in the config?
I don’t know if I’m this blind or what, but I can’t find a proper documentation for this. I must be looking at the wrong places.

step = self.parent.context.step["name"]

should do it

You do have to make sure you do actually have a step in the context or this call will fail.

1 Like

Thanks! That’s the one!
Could you point me to the source, where I should’ve found this answer on my own?

Hi Simon,

the documentation part on context of sgtk lives here:
https://developer.shotgridsoftware.com/tk-core/core.html?highlight=context#context

You can also fid a lot of this by inspecting, for example if you do:

from pprint import pprint

pprint(dir(context))

It will print out all the methods inside the context object.

Hope it helps.

1 Like