Start-up scripts

On start-up Natron will run different start-up scripts to let you setup anything like callbacks, menus, etc…

There are 2 different initialization scripts that Natron will look for in the search paths.


    This script is always run and should only initialize non-GUI stuff. You may not use it to initialize e.g. new menus or windows. Generally this is a good place to initialize all the callbacks that you may want to use in your projects.


    This script is only run in GUI mode (that is with the user interface). It should initialize all gui-specific stuff like new menus or windows.

All the scripts with the above name found in the search paths will be run in the order of the search paths.


This is important that the 2 scripts above are named and otherwise they will not be loaded.


These scripts are run well before any application instance (i.e: project) is created. You should therefore not run any function directly that might rely on the app variable (or app1, etc…). However you’re free to define classes and functions that may rely on these variable being declared, but that will be called only later on, when a project will actually be created.


A complete example of a can be found here .

Here is an example of a script, featuring:

  • Formats addition to the project

  • Modifications of the default values of parameters for nodes

  • PyPlug search paths modifications

#This Source Code Form is subject to the terms of the Mozilla Public
#License, v. 2.0. If a copy of the MPL was not distributed with this
#file, You can obtain one at */
#Created by Alexandre GAUTHIER-FOICHAT on 01/27/2015.

#To import the variable "natron"
import NatronEngine

def addFormats(app):

    app.addFormat ("720p 1280x720 1.0")
    app.addFormat ("2k_185 2048x1108 1.0")

def afterNodeCreatedCallback(thisNode, app, userEdited):
    #Turn-off the Clamp black for new grade nodes
    if thisNode.getPluginID() == "net.sf.openfx.GradePlugin":
    #Set the blur size to (3,3) upon creation
    elif thisNode.getPluginID() == "net.sf.cimg.CImgBlur":

#This will set the After Node Created callback on the project to tweek default values for parameters
def setNodeDefaults(app):

def setProjectDefaults(app):
    app.getProjectParam('frameRange').setValue(1, 0)
    app.getProjectParam('frameRange').setValue(30, 1)

def myCallback(app):

#Set the After Project Created/Loaded callbacks

#Add this path to the Natron search paths so that our PyPlug can be found.
#Note that we could also set this from the NATRON_PLUGIN_PATH environment variable
#or even in the Preferences panel, Plug-ins tab, with the "Pyplugs search path"