Access Shotgun context through python within an engine

## How to get a Shotgun API Connection

import sgtk

# get the engine we are currently running in

current_engine = sgtk.platform.current_engine()

# get hold of the shotgun api instance used by the engine, (or we could have created a new one)

sg = current_engine.shotgun

# Get current Context

current_context = current_engine.context
5 Likes