The engine = sgtk.platform.current_engine()
will only return an engine, if an engine is running.
If you launched Maya without the Shotgun integration, and then imported sgtk
, and then tried to run that, there wouldn’t be an engine present.
If you are using a centralized config, then you can use the sgtk API without bootstrapping the whole configuration. You would usually use one of the factory methods to create your self an Sgtk
instance, and access the Shotgun connection through there. Something like:
import sgtk
tk = sgkt.sgtk_from_entity("Project", 1234)
sg = tk.shotgun
If you are using a distributed config then you will need to follow the bootstrap guide I privately linked you, and perform a bootstrap of the engine.