Start-up scripts

On start-up, Autograph executes Python scripts to setup the application. You can add more scripts to be executed in the Python scripts directory, which is located

  • On Windows


  • On Linux and macOS


Any script in this directory (not recursively) will be executed. In Addition, foreach sub-folder that contains a file, the script will be executed.

These initialization scripts are executed very early in the application, before the main project is created. This is useful to register classes (e.g: Autograph.Application.registerPanelClass()) and other types. At this stage, since no Project is yet created, you can only register callbacks to be executed later, such as Autograph.Application.onProjectCreated() .

Command-line scripts

Autograph can also execute Python scripts provided from the command-line with the --exe_script <script> switch (which can be provided multiple times). The scripts provided on the command-line are executed after creating (or loading if a project file was supplied on the command-line) the main project. This is useful to tweak the project before starting a render.


import os, Autograph
from PySide2.QtQuick import *
from PySide2.QtQml import *
from PySide2.QtCore import Property, Signal, QObject

# Callback invoked when a project is created
def onProjectCreated(project):
    print("Python: Project created!")

# A custom menu action in the menubar
def myMenuAction():
    print("Python: Custom menu action"), "Python/My Action", "", "Ctrl+Shift+L")

print("Python: starting %s/ script. Autograph is background ? %s" % (, "Yes" if else "No"))

# A custom QObject to hold properties that we need to interact with QML
# Unfortunately, you cannot (yet) inherit both from QObject and Autograph.CustomPanel
# so we encapsulate every Property/Signal in a separate class add a member to the custom panel class
# See for basics of how to use Qt for Python
class MyPanelQObject(QObject):
    def __init__(self):
    def getValue(self):
        return self._value
    def setValue(self, v):
        if (self._value != v):
            self._value = v
    valueChanged = Signal(float)
    value = Property(float, getValue, setValue, notify=valueChanged)

# Custom Autograph Panel class
class MyPanel(Autograph.CustomPanel):
    def __init__(self):
        self._obj = MyPanelQObject()

    # Must be implemented to create the main QQuickItem
    def createMainItem(self):
        # Create a QQmlComponent from the QML file
        comp = QQmlComponent(, + '/MyPanel.qml')
        # Create an instance of the compoonent, passing it the QObject as property
        return comp.createWithInitialProperties({"panel": self._obj})

    # Returns a dict with the serialization to be saved in the workspace
    def saveInWorkspace(self):
        return {'value':self._obj.getValue()}

    # Load what was saved in saveInWorkspace()
    def loadFromWorkspace(self, container):
        except KeyError as e:

# Factory function for MyPanel
def makeMyPanel():
    return MyPanel()

# Register the panel class to Autograph, "com.leftangle.python.MyPanel", "My Panel", "", True)