Toolkit context menu items

We don’t call them out specifically in the docs, as @jhultgre mentions, its just a case of adding the app to the tk-shotgun engine, like you would add it to the tk-desktop engine or any other engine.

However I’ll mention this to the team to see if there is a suitable place to mention this in our docs.


Cool! Do you happen to have an example of how/if I would be able to do this using the tk-config-basic setup?

1 Like

So the tk-shotgun engine is added to all the root environment ymls for example:

and these point to:

And that is where the apps are being defined in the tk-shotgun engine.
So you just need to add your app definition/settings to that file and it should show up.


Thanks @philip.scadding, I can see what @jhultgre was saying about load reliability. I tried to add an App that we are hosting as an sg_uploaded_app on our SG site. It did not show up right away so I took that one out and tried adding one hosted locally using a dev descriptor. Then the first one with the ToolkitApp showed up, and it was not even in the config anymore. So, I cleared the browsing data and tried to load the SG pythonconsole from the app_store and all that managed to do was crash my Toolkit. LoL I have a feeling it is just a syntax issue with my descriptors.

1 Like

Yeah that is something that is on the list to document better as well.
That behaviour is expected though.
Basically on page load, it loads the cached items so that is it quick, and then sets about updating the cache if needed. So basically you need a double reload to see the changes.

It is a bit frustrating when testing things out, but its the trade off to allow quicker generation of menu items for the end user.

Hi @philip.scadding,

I managed to get the Toolkit App to show up in the right-click context menu for a Version:

But, I am not 100% confident when I make changes, that the updates are actually making it into what the action is running in the Shotgun web app. After getting this menu to show up on Version entities, I decided to change the init_app method, just to validate if this is what was controlling the entity_type. I changed this to “Playlist” and saved my file.

After several times refreshing the Desktop app and web browser, it is still showing up under Versions. I even tried deleting the ~/Library/Caches/Shotgun folder to completely reset Desktop, but that did not work. Is there a guranteed way to verify that I am actually getting the most recent code with updates and relaunch and not some cached version of the Toolkit app?

When I close the app and refresh the browser, the right-click menu displays the message Toolkit : Retrieving Actions... (click for details) for 5-10 minutes, or more. That makes the development time very painful. Especially when I am not 100% it’s even getting my new code…

When I execute the code I am getting this message in the output window:

import_framework could not determine the calling module layout! You can only use this method on items imported using the import_module() method!

But, I am not even importing any frameworks. I was at one time, when the menu item first showed up in the menu. But, I have removed the lines that setup the shotgunutils and qtwidgets frameworks:

# the frameworks required to run this app
    - {"name": "tk-framework-shotgunutils", "version": "v5.x.x"}
    - {"name": "tk-framework-qtwidgets", "version": "v2.x.x"}

Here is my current info.yml file:

# expected fields in the configuration file for this app

        type: list
        values: {type: shotgun_permission_group}
        allows_empty: True
        description: "An optional parameter which lets you limit the visibility of this app. 
                     If you for example put in ['Artist'] as the value for this parameter, 
                     any user belonging to the shotgun permissions group Artist will not be 
                     able to see or execute the App."
        type: list
        values: {type: str}
        allows_empty: True
        description: "An optional parameter which lets you turn off this app on certain platforms. 
                     If you don't want it to appear on the Shotgun Pipeline Toolkit action menu for 
                     a platform, just include it in the the deny_platforms list. Valid values are 
                     Windows, Mac and Linux."    

# the Shotgun fields that this app needs in order to operate correctly

# More verbose description of this item 
display_name: "Download Image Files"
description: "Application to download Version images."

# Required minimum versions for this item to run
requires_core_version: "v0.13.0"
requires_engine_version: "v0.1.0"

# the engines that this app can operate in:
supported_engines: [tk-shotgun]

Which is essentially just a direct copy of the info.yml from tk-shotgun-folders.


To help clear this up a bit, whilst the browser integration does cache the actions, it doesn’t cache the app specifically, so it should reload the changes each time you run it (if your app is setup with a dev/path descriptor). I think the problem you have here is a configuration issue, so it’s not showing up where you expect it to. I have a feeling there was an issue with adding it to Playlists specifically, I’ll ask someone to confirm. But remember it is the environment files that determine which environments your app shows up in.

In the cases where the app is showing, but running old code, it seems to me that it is probably pointing to a different version of your app than the one you are modifying, are you testing and modifying the correct config?

Yeah, that is too long. Unfortunately the more configurations you have the slower it will be. Try to limit the number of active configs on the project for you personally so that you can get better refresh times. The other thing to consider is where your user cache is stored, is it on the machine’s local hard drive? For other performance tips you can check out this doc though unfortunately, I didn’t have time to do one on browser integration specifically, that would be useful.

1 Like

Ah regarding Playlists, it was a bit different, it was discussed here:

1 Like

Hi @philip.scadding,

I changed to where I only have 2 site configs to my name. The Primary and my local dev sandbox. That got the Toolkit : Retrieving... time down to just under 4 min. Most users will only have Primary, so I guess that would be lessened for them.

I am not married to having my app show up in Playlists, that is just the first one I tried to get it to test not showing in Versions anymore. This particular app should eventually only land in Versions. But, I am not clear on what exactly is controlling that. I have the following line as part of my init_app() function in the file:

"entity_types": ["Version"],

I changed that to Shot, Asset, Task, etc. But, that made no difference. Is that the wrong place to control this? I also removed that line, yet the app still showed up in all entity types that have the Enable Pipeline Toolkit/File Publishes on this entity box checked. Which file should I be adding something if I want it to only show up under Versions, but not all entities? I have added these lines to the env/includes/shotgun/all.yml file:

    type: dev
    path: ~/pipeline/toolkit/apps/dvs-shotgun-download_versions

But, I do not see anything which controls which entity it should appear for in Shotgun. There does not appear to be a version.yml or a shot.yml or a asset.yml file in the tk-config-basic.

Thanks for the link on working with Custom Entities, as that will be the next step for a future app working on one of our customs.

1 Like

This is my env/includes/shotgun/all.yml file:

Do I have this (lines 37-40) setup correctly or should there be something added to the includes section up top (lines 15-19)? The last error I got when I ran my app was an error about not being able to find my engine download_versions. Here is my entire script:

So, I tried updating line 37 of the all.yml file (see above) to simply read download_versions: and now the entire thing no longer shows up in any right-click action menu, where it was previously working. So, I changed it back to dvs-shotgun-download_versions:. After several rounds of closing Desktop, deleting the local cache folder, re-starting the browser, etc. I still cannot get the action item to show up in any of the right-click menus.

My neighbors are about to become the proud new owners of a 27" Apply cinema display in their front yard!


Hey @mharris

I’m sorry you’re having a tough time there, its late here and we a company wide holiday tomorrow.
I can help you look into it on Monday. It probably makes sense to open a support ticket and send us your logs so we can see whats going on, and a copy of your config.

After a quick glance at what you’ve provided I would say your shotgun/all.yml looks fine, but have you modified your core hook in your config, so that it points at the correct environment file when the entity is Version?

1 Like

Hi @philip.scadding,

Monday would be fine. I have not modified the file as I was not aware that I needed to do that. What modifications should I make to that file? Mine is currently exactly what is in the GitHub repo that you linked.

I know you said it was on the backlog to update the docs, but it would really be helpful if there was either a guide or a YouTube video on how to go about adding action items to the context menu in the Shotgun web browser.


OK I’ve taken a closer look at what is happening here.

So I don’t think that the hook does need to be modified in this situation.
As you said it is exactly the same as the one in my link, which means it will be returning site when passed a Version entity. So assuming your site.yml is unchanged it will be pointing at the shotgun/all.yml, then all should be good there.

One thing you could do to ensure you’re in the right place, is to comment out the tk-multi-launchapp, double reload the page and then check to see if all the software entity launchers have disappeared.

I think what we need to see is your tk-desktop.log and tk-shotgun.log where debug has been enabled and the loading of actions reproduced. I’m expecting that there is an error in there somewhere. Could you please create a support ticket and attach those for us?


Ticket created:

For this I commented out the tk-multi-launchapp block in the env/includes/shotgun/all.yml file and double re-freshed the page in the SG web interface. The action menu item is no longer even showing up for me:


Great thanks for providing the logs.

That looks good then, you’re in the right place. I can see the Maya option has now disappeared. You can go ahead and add that back in, it was just a test to make sure that the right files were being edited.

As for the logs, it looks like your app is not showing up as your app contains an error:

2020-06-08 07:22:46,669 [16113 ERROR] App /Users/mharris/pipeline/toolkit/apps/dvs-shotgun-download_versions failed to initialize. It will not be loaded.
Traceback (most recent call last):
  File "/Users/mharris/Library/Caches/Shotgun/sgsite/p92c216.basic.shotgun/cfg/install/core/python/tank/platform/", line 2792, in __load_apps
  File "/Users/mharris/pipeline/toolkit/apps/dvs-shotgun-download_versions/", line 40, in init_app
    self.logger = sgtk.platform.get_logger(__name__)
AttributeError: can't set attribute

Application.logger is a read only property, and can’t be set.

1 Like

Hi Philip,

That makes sense as to why that would stop loading. I was adding the logger for a simple log output just to make sure my code was actually working. I copied the logger line from the of the tk-multi-starterapp. That seems to work fine. What would be the proper way to initialize a logger into this app? I just want to put a simple print statement to show what the selected ids are when my app is invoked.

1 Like

It depends where you want to add the logger. In the starter app it is not adding it as a property to the Application instance, it is just creating a variable in the module.
The Application instance already has the logger property so you can just use that:"Hello")

The starter app logic could have also been:

Alright, so removing that line the menu item is back and it is actually running to log the selected Versions. Now, how can I get this menu item to only appear for Versions? It is showing in all entity types that are part of the Enable Pipeline Toolkit/File Publishes on this entity list.


This is where you need to branch your environment files. As I mentioned the hook is what picks which environment file to use when given a context. So you will need to modify that and create an environment file for Version entities that contains the tk-shotgun engine, which in turn has your custom app registered against it.

I’m checking with our team to see if we have any documentation around this.


The Environment Configuration Reference is what I was thinking of, it explains how the environment files are setup.