We use the following function and it seems to work. The key is deleting all sgtk-related modules from
sys.modules and removing
TANK_CURRENT_PC from the environment. There was an article about this on the Shotgun website a while back.
def get_sgtk(proj_name, script_name):
""" Load sgtk path and import module
If sgtk was previously loaded, replace include paths and reimport
project_path = get_proj_tank_dir(proj_name)
"install", "core", "python"
# unload old core
for mod in filter(lambda m: m.startswith("sgtk") or m.startswith("tank"), sys.modules):
if "TANK_CURRENT_PC" in os.environ:
Overall, I too find it annoying that you cannot use the same toolkit, but there’s all kinds of questions about versioning, etc.