Share

Python API

The Flame Python API is a tool for any Flame user looking to script their workflow and automate tedious tasks.

The Python API is accessed via the Flame Python Console. This console gives you a place to write and execute code while working in Flame.

The Flame module is the core of the Python API. This module contains all that you need to use the Flame Python API.

The Python API uses Python version 3.11.5, since Flame Family 2025.

New to the flame Python API?

Write Your First Python API Script shows a small and basic example to get you started.

The Flame API Code Samples contains code snippets that should give some ideas on the structure of the API, and how to use it. You will also find examples of scripts in /opt/Autodesk/<flame_version>/python_examples.

Note: Some functions and attributes may not be available in Flare or Flame Assist.



What's New in 2025.2 Update

New Commands: Morph

All controls of the Morph tool can be set using the Python API.

Command: <PyMorphNode>.interpolation

Type: Attribute

Description: Used to set or get the Frame Interpolation mode. One of the following must be passed as an argument when the attribute is set:

  • Machine Learning
  • Motion Vectors

Command: <PyMorphNode>.rendering_platform (Rocky Linux only)

Type: Attribute

Description: Used to set or get the Rendering Platform option. One of the following must be passed as an argument when the attribute is set:

  • GPU
  • CPU

Command: <PyMorphNode>.ml_engine_cache (Rocky Linux only)

Type: Attribute

Description: Used to set or get the status of the ML Engine Cache button. One of the following must be passed as an argument when the attribute is set:

  • True to enable the button
  • False to disable the button

Command: <PyMorphNode>.use_16_bit_fp (Rocky Linux only)

Type: Attribute

Description: Used to set or get the bit depth value at which the Machine Learning model runs. One of the following must be passed as an argument when the attribute is set:

  • True to select 16-bit fp
  • False to select 32-bit fp

Command: <PyMorphNode>.motion_analysis_quality

Type: Attribute

Description: Used to set or get the Motion Vector's Motion Analysis mode. One of the following must be passed as an argument when the attribute is set:

  • Use 1/16 Resolution
  • Use 1/8 Resolution
  • Use 1/4 Resolution
  • Use 1/2 Resolution
  • Use Full Resolution

Command: <PyMorphNode>.motion_blur

Type: Attribute

Description: Used to set or get the status of the Motion Blur button. One of the following must be passed as an argument when the attribute is set:

  • True to enable the button
  • False to disable the button

Command: <PyMorphNode>.samples

Type: Attribute

Description: Used to set or get the Samples value. An integer value between 3 and 25 must be passed as the argument.

Command: <PyMorphNode>.shutter

Type: Attribute

Description: Used to set or get the Shutter value. A float value between 0.05 and 10.00 must be passed as the argument.

Command: <PyMorphNode>.reference

Type: Attribute

Description: Used to set or get the status of the Reference button. One of the following must be passed as an argument when the attribute is set:

  • True to enable the button
  • False to disable the button

Command: <PyMorphNode>.reference_colour

Type: Attribute

Description: Used to set or get the colour of the Reference widget. A tuple containing three colour values between 0.0 and 1.0 must be passed as the argument.

Example:

# Set the Reference colour of a Morph node to Green
m = flame.batch.create_node("Morph")
m.reference_colour = (0.0, 1.0, 0.0)

Command: <PyMorphNode>.reference_position_x

Type: Attribute

Description: Used to set or get the Reference X Position value. An integer value between 0 and 10 000 must be passed as the argument.

Command: <PyMorphNode>.reference_position_y

Type: Attribute

Description: Used to set or get the Reference Y Position value. An integer value between 0 and 10 000 must be passed as the argument.

Command: <PyMorphNode>.range_mode

Type: Attribute

Description: Used to set or get the Range mode. One of the following must be passed as an argument when the attribute is set:

  • All Frames
  • Custom Range

Command: <PyMorphNode>.range_first_frame

Type: Attribute

Description: Used to set or get the Range's First Frame value. An integer value between the Batch Group's start frame and end frame must be passed as an argument when the attribute is set.

Command: <PyMorphNode>.range_last_frame

Type: Attribute

Description: Used to set or get the Range's Last Frame value. An integer value between the Batch Group's start frame and end frame must be passed as an argument when the attribute is set.

Command: <PyMorphNode>.mix

Type: Attribute

Description: Used to set or get the Morphing Mix value. A float value between 0.0 and 100.00 must be passed as the argument.

Command: <PyMorphNode>.freeze_first_frame

Type: Attribute

Description: Used to set or get the status of the First Frame's freeze button. One of the following must be passed as an argument when the attribute is set:

  • True to enable the button
  • False to disable the button

Command: <PyMorphNode>.freeze_last_frame

Type: Attribute

Description: Used to set or get the status of the Last Frame's freeze button. One of the following must be passed as an argument when the attribute is set:

  • True to enable the button
  • False to disable the button

Command: <PyMorphNode>.set_mix_to_range()

Type: Function

Description: Used to execute a Set Mix to Range operation.


New Commands: Render node

The status of the Apply Colour Coding button and Tags can be set through the Python API.

Command: <PyRenderNode>.apply_colour_coding

Type: Attribute

Description: Used to set or get the status of the Apply Colour Coding. One of the following must be passed as the argument when the attribute is set:

  • True to enable the button
  • False to disable the button

Command: <PyRenderNode>.tags

Type: Attribute

Description: Used to set tags on a clip originating from a Render node. To add a tag, a list of strings must be passed as an argument.

Examples:

The following examples show how to set tags on a Render node.

# Add Tags on a Render node.
r = flame.batch.create_node("Render")
r.tags = ["TagA","TagB"]
# Append a Tag to existing Tags.
all_tags = <PyNode>.tags.get_value()
all_tags.append("TagC")
<PyNode>.tags = all_tags
# Clear all Tags on a Render node.
<PyNode>.tags = []

New Commands: Write File node

The status of the Apply Colour Coding button can be set through the Python API.

Command: <PyWriteFileNode>.apply_colour_coding

Type: Attribute

Description: Used to set or get the status of the Apply Colour Coding. One of the following must be passed as the argument when the attribute is set:

  • True to enable the button
  • False to disable the button

New Commands: PyNode

The colour coding of a node can be set through the Python API.

Command: <PyNode>.schematic_colour

Type: Attribute

Description: Used to set or get the colour of a Schematic node using RGB values. A tuple containing three colour values between 0.0 and 1.0 must be passed as the argument.

# Set the colour of the current Schematic node to Red
flame.batch.current_node.get_value().schematic_colour = (0.6, 0.0, 0.0)

Command: <PyNode>.schematic_colour_label

Type: Attribute

Description: Used to set or get the colour of a node using a colour label. A string must be passed as the argument when the attribute is set.

# Set the colour of the current Schematic node to a colour associated to a label.
flame.batch.current_node.get_value().schematic_colour_label = "In Progress"

Command: <PyNode>.clear_schematic_colour()

Type: Function

Description: Used to clear the colour of a Schematic node.

# Clear the colour of all Schematic node in the current Batch Group
for node in flame.batch.nodes:
     node.clear_schematic_colour()




What's New in 2025.1 Update

Updated Commands: Action

Command: <PyActionNode>.create_node()

Type: Function

Description: A new input_colour_space argument can be set to convert the texture to the Action working space. A valid colour space must be set as an argument. The argument is optional and resolves to "From Files or Rules" by default.

Command: <PyActionNode>.import_psd()

Type: Function

Description: A new input_colour_space argument can be set to convert the texture to the Action working space. A valid colour space must be set as an argument. The argument is optional and resolves to "From Files or Rules" by default.

Command: <PyActionNode>.import_fbx()

Type: Function

Description: A new input_colour_space argument can be set to convert the texture to the Action working space. A valid colour space must be set as an argument. The argument is optional and resolves to "From Files or Rules" by default.

Command: <PyActionNode>.read_fbx()

Type: Function

Description: A new input_colour_space argument can be set to convert the texture to the Action working space. A valid colour space must be set as an argument. The argument is optional and resolves to "From Files or Rules" by default.


Updated Commands: Batch

Command: <PyBatch>.create_node()

Type: Function

Description: The path to the model can be passed as an additional argument when an Inference node is created.

Example:

# Create an Inference node with a specific model
flame.batch.create_node("Inference", "/var/tmp/model.onnx")

New Commands: Frequency

Command: <PyNode>.separation

Type: Attribute

Description: Used to get or set the Separation Mode. One of the following must be passed as an argument when the attribute is set:

  • 2 Bands
  • 3 Bands

Command: <PyNode>.blur_mode_low

Type: Attribute

Description: Used to get or set the Low Blur Mode. One of the following must be passed as an argument when the attribute is set:

  • Box
  • Gaussian

Command: <PyNode>.blur_width_low

Type: Attribute

Description: Used to get or set the Low Blur Width. A float value between 0.0 and 1000.00 must be passed as an argument when the attribute is set.

Command: <PyNode>.blur_height_low

Type: Attribute

Description: Used to get or set the Low Blur Height. A float value between 0.0 and 1000.00 must be passed as an argument when the attribute is set.

Command: <PyNode>.blur_mode_mid

Type: Attribute

Description: Used to get or set the Mid Blur Mode. One of the following must be passed as an argument when the attribute is set:

  • Box
  • Gaussian

Command: <PyNode>.blur_width_mid

Type: Attribute

Description: Used to get or set the Mid Blur Width. A float value between 0.0 and 1000.00 must be passed as an argument when the attribute is set.

Command: <PyNode>.blur_height_mid

Type: Attribute

Description: Used to get or set the Mid Blur Height. A float value between 0.0 and 1000.00 must be passed as an argument when the attribute is set.

Command: <PyNode>.centre_scale

Type: Attribute

Description: Used to get or set the status of the Centre & Scale button. One of the following must be passed as an argument when the attribute is set:

  • True
  • false

New Commands: Inference

Command: <PyNode>.model_name

Type: Read-Only Property

Description: Used to get the name of the current model loaded in the Inference node.


New Commands: Lens Distortion

Command: <PyNode>.import_lens_distortion()

Type: Function

Description: Used to import a compatible lens distortion JSON file created from a third-party application. The complete file path to the file must be set as an argument.

Example:

# Import a compatible Lens Distortion file generated from another application.
ld = flame.batch.create_node("Lens Distortion")
ld.import_lens_distortion("/var/tmp/file.json")

New Commands: Media Panel

Command: <PyClip>.tags

Type: Attribute

Description: Used to get or set tags on a Clip. To add a tag, a list of strings must be passed as an argument.

Examples:

The following examples show how to use tags on clips. The same examples apply to all object listed in the Media Panel section.

# Add Tags on a Clip.
<PyClip>.tags = ["TagA","TagB"]
# Append a Tag to existing Tags.
all_tags = <PyClip>.tags.get_value()
all_tags.append("TagC")
<PyClip>.tags = all_tags
# Clear all Tags on a Clip.
<PyClip>.tags = []
# Get the Tags of a Clip.
for tag in <PyClip>.tags:
    print(tag)

Command: <PyBatch>.tags

Type: Attribute

Description: Used to get or set tags on a Batch Group. To add a tag, a list of strings must be passed as an argument.

Command: <PyDesktop>.tags

Type: Attribute

Description: Used to get or set tags on a Desktop. To add a tag, a list of strings must be passed as an argument.

Command: <PyFolder>.tags

Type: Attribute

Description: Used to get or set tags on a Folder. To add a tag, a list of strings must be passed as an argument.

Command: <PyLibrary>.tags

Type: Attribute

Description: Used to get or set tags on a Library. To add a tag, a list of strings must be passed as an argument.

Command: <PyReel>.tags

Type: Attribute

Description: Used to get or set tags on a Reel. To add a tag, a list of strings must be passed as an argument.

Command: <PyReelGroup>.tags

Type: Attribute

Description: Used to get or set tags on a Reel Group. To add a tag, a list of strings must be passed as an argument.

Command: <PySequence>.tags

Type: Attribute

Description: Used to get or set tags on a Sequence. To add a tag, a list of strings must be passed as an argument.

Command: <PyWorkspace>.tags

Type: Attribute

Description: Used to get or set tags on a Workspace. To add a tag, a list of strings must be passed as an argument.

Command: <PyClip>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Clip using a colour label. A string must be passed as the argument when the attribute is set.

Example:

The following example show how to set a colour on a clip using a label. The same example applies to all object listed in the Media Panel section.

# Set the colour of the selected clip in the Media Panel.
clip = flame.media_panel.selected_entries[0]
clip.colour_label = "Approved"

Command: <PyBatch>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Batch Group using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyDesktop>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Desktop using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyFolder>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Folder using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyLibrary>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Library using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyReel>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Reel using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyReelGroup>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Reel Group using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PySequence>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Sequence using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyWorkspace>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Workspace using a colour label. A string must be passed as the argument when the attribute is set.

Command: <PyBatchGroup>.clear_colour()

Type: Function

Description: Used to clear the colour of a Batch Group.

Command: <PyDesktop>.clear()

Type: Function

Description: Used to clear the content of the current Desktop.


New Commands: PyMarkers

Command: <PyMarker>.colour_label

Type: Attribute

Description: Used to set or get the colour of a Marker using a colour label. A string must be passed as the argument when the attribute is set.

Example:

The following example show how to set a colour on a marker using a label.

# Create a Marker in the clip opened in the Timeline and set its colour using a label.
marker = flame.media_panel.selected_entries[0].create_marker(10)
marker.colour_label = "To Review"

Command: <PyMarker>.locked_location

Type: Attribute

Description: Used to lock or unlock a marker's location. One of the following must be passed as an argument:

  • True
  • False

New Commands: PyProject

Command: <PyProject>.working_colour_space

Type: Attribute

Description: Used to get or set the working colour space of the project.

Command: <PyProject>.action_colour_spac

Type: Attribute

Description: Used to get or set the working colour space of the project.

Command: <PyProject>.get_available_colour_spaces()

Type: Function

Description: Used to get or set the working colour space of the project.


New Commands: Timeline

Command: <PySegment>.tags

Type: Attribute

Description: Used to get or set tags on a Timeline segment. To add a tag, a list of strings must be passed as an argument.

Examples:

# Add Tags on a Timeline segment.
<PySegment>>.tags = ["TagA","TagB"]
# Append a Tag to existing Tags.
all_tags = <PySegment>.tags.get_value()
all_tags.append("TagC")
<PySegment>.tags = all_tags
# Clear all Tags on a Timeline segment.
<PySegment>.tags = []
# Get the Tags of a Timeline segment.
for tag in <PySegment>.tags:
    print(tag)

Command: <PySegment>.source_frame_rate

Type: Read-Only Property

Description: Used to get the source frame rate of a timeline segment.



What's New in 2025

PySide6 Support

The version of PySide used by Flame Family products has been upgraded to PySide6 and any script using PySide2 will no longer work as expected.

If you plan to use your scripts with multiple version of Flame Family products, make sure to modify your scripts to either test for the current version of PySide or use the flame.get_version() function.

Here is an example of an existing script converted to be used in older versions of the application as well as in the 2025 version:

PySide2

from PySide2 import QtWidgets, QtCore, QtGui
resolution = QtWidgets.QDesktopWidget().screenGeometry()
some_action = QtWidgets.QAction("some action")
vbox = QtWidgets.QVBoxLayout()
vbox.setMargin(10)

PySide6

try:
    from PySide6 import QtWidgets, QtCore, QtGui
except ImportError:
    from PySide2 import QtWidgets, QtCore, QtGui
 
if QtGui.__version_info__[0] < 6:
    mainWindow = QtWidgets.QDesktopWidget()
    QAction = QtWidgets.QAction
else:
    mainWindow = QtGui.QGuiApplication.primaryScreen()
    QAction = QtGui.QAction
 
resolution = mainWindow.screenGeometry()
some_action = QAction("some action")
vbox = QtWidgets.QVBoxLayout()
vbox.setContentsMargins(10, 10, 10, 10)

For more information, please visit the Qt PySide documentation.



Updated Commands: Clamp

Command: <PyNode>.min_clamp

Type: Attribute

Description: Used to enable or disable set the Minimum Clamp button. One of the following must be passed as an argument:

  • True to enable the button.
  • False to disable the button.

Command: <PyNode>.max_clamp

Type: Attribute

Description: Used to enable or disable set the Maximum Clamp button. One of the following must be passed as an argument:

  • True to enable the button.
  • False to disable the button.

Command: <PyNode>.min_value

Type: Attribute

Description: Used to get or set the value for the Minimum Clamp button. A float value must be passed as an argument.

Command: <PyNode>.max_value

Type: Attribute

Description: Used to get or set the value for the Maximum Clamp button. A float value must be passed as an argument.


Updated Commands: Keyboard Shortcuts

Command: flame.users.current_user.shortcuts_profile

Type: Attribute

Description: Used to get or set the keyboard shortcuts profile. One of the following must be passed as an argulement:

  • Flame
  • Smoke Classic
  • Smoke (FCP 7)
  • Lustre

New Commands: STMap

Command: <PyNode>.framing_mode

Type: Attribute

Description: Used to get or set the framing mode. One of the following must be passed as an argument when the mode is set:

  • Use Entire Front Frame
  • Use STMap to Front Ratio
  • Use Data & Display Window

Command: <PyNode>.data_window_min_x

Type: Attribute

Description: Used to get or set the Data Window Min X value. One of the following must be passed as an argument when a value is set:

  • An integer number between -16384 and 16384.

Command: <PyNode>.data_window_min_y

Type: Attribute

Description: Used to get or set the Data Window Min Y value. One of the following must be passed as an argument when a value is set:

  • An integer number between -16384 and 16384.

Command: <PyNode>.data_window_max_x

Type: Attribute

Description: Used to get or set the Data Window Max X value. One of the following must be passed as an argument when a value is set:

  • An integer number between -16384 and 16384.

Command: <PyNode>.data_window_max_y

Type: Attribute

Description: Used to get or set the Data Window Max Y value. One of the following must be passed as an argument when a value is set:

  • An integer number between -16384 and 16384.

Command: <PyNode>.display_window_min_x

Type: Attribute

Description: Used to get or set the Display Window Min X value. One of the following must be passed as an argument when a value is set:

  • An integer number between 0 and 16384.

Command: <PyNode>.display_window_min_y

Type: Attribute

Description: Used to get or set the Display Window Min Y value. One of the following must be passed as an argument when a value is set:

  • An integer number between 0 and 16384.

Command: <PyNode>.display_window_max_x

Type: Attribute

Description: Used to get or set the Display Window Max X value. One of the following must be passed as an argument when a value is set:

  • An integer number between 0 and 16384.

Command: <PyNode>.display_window_max_y

Type: Attribute

Description: Used to get or set the Display Window Max Y value. One of the following must be passed as an argument when a value is set:

  • An integer number between 0 and 16384.

Command: <PyNode>.offset_x

Type: Attribute

Description: Used to get or set the Offset X value. A float number included between the negative and positive values of the STMap clip width resolution but be passed as an argument.

Command: <PyNode>.offset_y

Type: Attribute

Description: Used to get or set the Offset Y value. A float number included between the negative and positive values of the STMap clip height resolution but be passed as an argument.

Command: <PyNode>.repeat_mode

Type: Attribute

Description: Used to get or set the repeat mode. One of the following must be passed as an argument when the mode is set:

  • Repeat Off
  • Mirrored Repeat
  • Tiled Repeat
  • Repeat Last

Command: <PyNode>.filter_mode

Type: Attribute

Description: Used to get or set the framing mode. One of the following must be passed as an argument when the mode is set:

  • Nearest
  • Linear
  • Mitchell-Netravali
  • Catmull-Rom
  • Anisotropic
  • Aniso + Linear
  • EWA
  • EWA + Linear

Was this information helpful?