Nuke: creating custom menus using Python 2018

Making custom scripts easily accessible can be a big time saver and necessary when optimising your pipeline. This tutorial will explain how you can setup custom menus in Nuke, that will execute your own Python scripts.

Though The Foundry’s own guide is fairly thorough, it’s missing a complete example of running your own scripts.

So let’s get started!

Creating the menu file

Create a file called inside the one of the folders listed below based on your system.


Mac OS X:

C:\Program Files\Nuke10.5v7\plugins\nukescripts or
C:\Program Files (x86)\Nuke10.5v7\plugins\nukescripts
C:\Program Files\Nuke10.5v7\plugins

Open and add the following code:

import my_script

menu ="Nuke")
menu.addCommand("My Menu/Run My Awesome Code", lambda: my_script.my_function())

The first line imports our custom script, which we’ll make in a second. The last two lines creates a variable that points to Nuke’s menu, and afterwards adds a new menu called “My Menu” with the menu item “Run My Awesome Code”.┬áThe lambda: part is the imported module and function which will be called. It will end up looking like this.

Adding a script

Next, create a file called “” with the following code:

import nuke

def my_function():
	read = nuke.createNode("Read")
	write = nuke.createNode("Write")

Putting things into subfolders

To avoid creating a mess, it would be best if we saved our files in some subfolders. Assuming you’ve placed your files in one of the above-mentioned locations, create a folder called “my_scripts”, and move “” to it. Create another folder inside called “scripts”, and move “” to it. In the end you should have a structure like this:

In order for Nuke to read our files, we need to add a couple of “” files that adds our new folders to Nuke’s plugin paths. The final structure will look like this:

Now, open the first “” file add the line nuke.pluginAddPath("./my_scripts").

For the “” inside “my_scripts” add nuke.pluginAddPath("./scripts").


That’s it! Restart Nuke, to see your new and shiny menu appear.

Download the sample code:

Write a comment