Hello – you’ll want to add the path to Toolkit Core API to your sys.path in Python; then you should be able to import sgtk. If you have a centralized Toolkit pipeline configuration, by default it should have its own copy of the Core API in the install/core/ directory, and within that, we want to get to the python/ directory. So, in my case, my pipeline config is in /sgtk/software/shotgun/goats, so the following works:
This will allow your code to run, but depending on what you’re doing in your script with the Toolkit API, it may require Toolkit’s tk-maya engine to be running and/or for you to have a Toolkit context.
To have this path added to your sys.path every time Maya is launched, you can add it to the PYTHONPATH environment variable via the Maya.env file, or add the above lines of Python to Maya’s user_setup.py file. You can see the sections on Initializing the Maya Environment in and for Python and Adding Items to your Python Path in the Python in Maya page from Maya’s documentation.
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:
is this the project id or can it be 1234 sorry very dumb question but just wanne make sure because if this is the project id i will need to start up the Api to set it up ass i understand to get the project id 1st