Handy Tips – The shell command

Often when you do maintenance, configuration or development work, it is handy to be able to quickly pull up an interactive python shell and run some quick code!

This is quite easy to do when you are inside of Maya, Nuke or any of the other graphical Toolkit engines - you just bring up an interactive Python window and start typing:

>>> import sgtk
>>> curr_engine = sgtk.platform.current_engine()

tank_shell_angle.png

With Core release v0.14.16, we have added similar functionality for the shell engine! So you can quickly bring up a fully initialized python session for a shot, asset or project using the tank command. Just tell the tank command to start the shell action and it will launch a Python interpreter for you (see screenshot above!). Once the Python interpreter has launched, you can access the variables tk, shotgun, context and engine directly for quick access to the various key toolkit objects!

 

 

 

Follow

1 Comments

  • 0
    Avatar
    Sebastian Bilbao

    Hi, do you have more docs on how to work with shotgun via command line?

    Thanks,

    s.

Please sign in to leave a comment.