← All DaVinci Resolve API guides
DaVinci Resolve APIBeginnerTimeline

How to Create a Timeline in DaVinci Resolve with Python

CreateEmptyTimeline, CreateTimelineFromClips, and validation of the newly created sequence

Use either an empty Timeline or a Timeline created directly from imported Media Pool clips, depending on how much control your automation needs over the assembly process.

API

Resolve Scripting API

Language

Python

Resolve

19–20+

Requires

Running Resolve

Syntax

timeline = media_pool.CreateEmptyTimeline("API_Timeline")

Parameters

  • The relevant arguments are shown in the complete working example below. Validate paths, object types, and required project state before calling the API method.

Returns

Always validate the returned object, list, identifier, or boolean before continuing to the next automation step.

Complete working Python exampleuse it as a starting point for your own script
import os
import sys
from pathlib import Path


def import_resolve_module():
    try:
        import DaVinciResolveScript as dvr
        return dvr
    except ImportError:
        search_paths = [
            os.environ.get("RESOLVE_SCRIPT_API", ""),
            os.environ.get("RESOLVE_MODULES", ""),
            r"C:\\ProgramData\\Blackmagic Design\\DaVinci Resolve\\Support\\Developer\\Scripting\\Modules",
            "/opt/resolve/Developer/Scripting/Modules",
            "/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules",
            str(Path.home() / "Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting/Modules"),
        ]
        for path in search_paths:
            if path and os.path.isdir(path) and path not in sys.path:
                sys.path.append(path)
        import DaVinciResolveScript as dvr
        return dvr


dvr = import_resolve_module()

clip_paths = [r"D:\\Resolve\\source\\clip_01.mp4"]
clip_paths = [path for path in clip_paths if os.path.isfile(path)]

resolve = dvr.scriptapp("Resolve")
if not resolve:
    raise RuntimeError("Resolve API is unavailable")

project = resolve.GetProjectManager().GetCurrentProject()
if not project:
    raise RuntimeError("No project is open")

media_pool = project.GetMediaPool()

if clip_paths:
    clips = media_pool.ImportMedia(clip_paths)
    timeline = media_pool.CreateTimelineFromClips("API_Timeline_From_Clips", clips)
else:
    timeline = media_pool.CreateEmptyTimeline("API_Empty_Timeline")

if not timeline:
    raise RuntimeError("Timeline was not created")

print("Created timeline:", timeline.GetName())

Guide

Two ways to create a Timeline

When the clips are already known and imported, CreateTimelineFromClips() is convenient. When you want to create the sequence first and add media later, use CreateEmptyTimeline(). Both methods are called on the Media Pool.

When an empty Timeline is useful

An empty Timeline is a good fit when the project will be assembled in stages: create tracks, import media, then append or place clips. It gives the automation explicit control over the order of operations.

When to create a Timeline from clips

CreateTimelineFromClips() is useful for a fast assembly from a prepared list of MediaPoolItem objects. In the example, files are imported first and the returned clips are immediately used to create the sequence.

Always validate the result

Check that the returned timeline is not None before reading FPS, iterating clips, or configuring a render. A failed creation call should stop the workflow before later API calls assume a valid sequence exists.

How the example works

1

Connect to Resolve

Establish a Resolve Scripting API connection and stop early if the application object is unavailable.

2

Validate the current context

Check the active project, Timeline, Media Pool, source paths, or Render Queue state required by this specific operation.

3

Run the core API operation

Execute the operation demonstrated in this guide: how to create a timeline in davinci resolve with python.

4

Validate the result

Check the returned value before the workflow continues. Resolve methods often signal an unavailable object or failed operation with None, False, or an empty result.

Resolve API notes

  • CreateTimelineFromClips expects MediaPoolItem objects, not file paths.
  • Timeline names are strings.
  • When clip_paths is empty, the example falls back to creating an empty Timeline.
  • After creation you can use project.GetCurrentTimeline() to retrieve the active sequence.

Common errors

Resolve API is unavailable

Reason: Resolve is closed or Python cannot import/use DaVinciResolveScript.

Fix: Start Resolve and verify the Developer/Scripting/Modules path from the same Python interpreter used by the script.

The method returns None or False

Reason: A required project, Timeline, clip, preset, path, or application state is missing.

Fix: Validate each input and add explicit result checks after important Resolve API calls.

The script only works on one workstation

Reason: Paths or environment assumptions are hard-coded for a single operating system or machine.

Fix: Move paths into configuration and support the required Windows, Linux, and macOS locations explicitly.

Next step

Continue only after the current operation has returned the expected Resolve object or result.

Related API guides