Open file on launch from Shotgun web or Desktop tk-photoshopcc engine

Hi All,

I am trying to setup a workflow where a dcc (photoshop) opens the latest version of a asset once launched. I am new to using toolkit and a little lost in the documentation. Can someone please point me in the right direction…

I have been trying to follow this: How to open the latest file automatically when launching software from a Task with no luck, then i realized that tk-photoshop engine starts its own version of python… How do i start debugging this…

Best,
Jag.

4 Likes

Hi welcome to the forums!!

So the Shotgun Adobe Panel should have a console that you can check out for output:

Also you may find info in the Toolkit logs.
Enabling debug logging may help, depending on the cause of the issue.

3 Likes

Thanks @philip.scadding i forgot to mention that i am still on tk-core version 0.18.50, is there a way to know what hooks are supported by a app / engine ? I think i am having trouble with finding the right place to integrate.

i was trying to use app_launch.py hook but it does not seem like the right place to do hook into

I need to be doing things after the engine is initialized and the Shotgun Panel has loaded

2 Likes

Oh wow, that is an old core, from back in early 2017! I’d highly recommend updating if you can.

That said, it seems like you would want the engine_init.py core hook, if you want to run code after the engine has launched. This will run every time the engine starts up, and also when it is reloaded. It is also called for every engine so you will need to check the engine name first.
Something like:

import os

if engine.name == "tk-photoshopcc":
    # set an env var so that we only execute this once on the launch of Photoshop
    first_init = os.environ.get("FIRST_INIT")
    # If the env is not set then this is the first time the engine init has run in this session of Photoshop
    if not first_init:
        # Now set the env var so that this code won't run again for this session
        os.environ["FIRST_INIT"] = "1"
        # now run any code that needs to be run on startup
4 Likes