Set Positioner on PyClip

I’ve got a selection of clips that I’m trying to change the start and positioner timecode of using python. However, I’m noticing that I cannot set the current time past the Media End on the PyClip, and if I open it up as a PySequence, I can’t get it to accept current time as an attribute of the PySequence. The result of which means, I have to either open the clip as a sequence first (in which case it runs successfully). Ideally, I’d like to get the script to open the clip and apply the PyTime changes, but perhaps I’m trying to do something that isn’t possible. Any insight would be appreciated! Here is the Python script:

Best,

Mike

“”"
target_timecode = ‘00:59:47:00’
target_fps = ‘23.976 fps’
positioner = ‘00:59:58:00’

if not selection:
    print("No items selected. Please select one or more clips.")
    return

for item in selection:

    if isinstance(item, (flame.PyClip, flame.PySequence)):
        try:
            item.open_as_sequence()
            new_time = flame.PyTime(target_timecode, target_fps)
            item.start_time = new_time
            item.current_time = flame.PyTime(positioner, target_fps)

item is no longer valid after item.open_as_sequence() which return a PySequence. You need something like this.

            sequence = item.open_as_sequence()
            new_time = flame.PyTime(target_timecode, target_fps)
            sequence.start_time = new_time
            sequence.current_time = flame.PyTime(positioner, target_fps)
1 Like

Upon further testing, perhaps I’m running into a bug.

I’m able to get the script to run as intended using seq = item.open_as_sequence(), but once I restart the software, the script returns an error unless I rescan the Python hooks. This is some of the behavior I was noticing when troubleshooting with @philm on Discord. At first I thought it was a syntax error because I am new to using Python in Flame, but I tried using item.in_mark to achieve something similar, and the result was the same. It runs while I’m using the software, but errors out with a restart until I rescan Python Hooks.

I am happy to post an example of the full script if that would help in any sort of bug reporting(I’m using Flame 2025.2.2.), but for now I’ll just open the sequence first and then run it the script. It works error free if I run it that way.

Thanks @PhilippeJ & @philm . I really appreciate it.