# Basic python help - move clips to timeline

**URL:** <https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342>\
**Category:** Python\
**Tags:** python, timeline, library\
**Created:** [August 5, 2025, 8:07pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342 "2025-08-05T20:07:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![cicero](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cicero](https://forum.logik.tv/u/cicero)\
**Post date:** [August 5, 2025, 8:07pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/1 "2025-08-05T20:07:12Z")

</div>

Hi all, trying to write a simple python script to overwrite clips onto a timeline, and could use some pointers.

These are source clips which will normally have source TC which matches timeline rec TC.

The aim is to:

- select one or more clips in library
- fetch start TC from each
- move current record timeline playhead to same TC
- overwrite on current primary track
- loop to end of selection

I can successfully fetch the start TC from source clip using `item.start_time`.

Then I need to switch focus to the record timeline - to remove any existing in/out marks and move the playhead to the source TC equivalent - before performing the overwrite. But I can’t find a way to switch focus, so any `flame.timeline` or `flame.current_sequence` functions seem just to apply to the selected source clip timeline (loaded on the green tab), not to the recored timeline (red tab). Any ideas?

The only way I can see to perform the overwrite function is using `flame.execute_shortcut("Overwrite Edit")` but is there a cleaner way?

Of course there may be an entirely different and better way to approach this.

TIA!

---

<div class="post-metadata">

**Author:** ![dazedinheaven](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/dazedinheaven/32/8669_2.png) [@dazedinheaven](https://forum.logik.tv/u/dazedinheaven)\
**Post date:** [August 5, 2025, 8:59pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/2 "2025-08-05T20:59:38Z")

</div>

There may be a more elegant way but one thing that came to mind was to use selection order. Select the record sequence first, then all the source clips, and store the first item in your selection as a variable that you can do timeline operations on. I just tested and `flame.media_panel.selected_entries` and the `selection` tuple that gets passed from the `get_media_panel_custom_ui_actions()` hook both respect selection order.

---

<div class="post-metadata">

**Author:** ![Jason\_Chambers](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jason\_Chambers](https://forum.logik.tv/u/Jason_Chambers)\
**Post date:** [August 6, 2025, 11:14am UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/3 "2025-08-06T11:14:17Z")

</div>

This will do what you’re after, Just select the clips in the media panel and it will add them to the current sequence using source tc, doesn’t have any ability to deal with multiple clips with the same tc so will overwrite the last selected.

[Auto Sequence.zip](https://forum.logik.tv/uploads/short-url/tmhgPDiyAIGAwXMGALnxh3LbtAu.zip) (3.0 KB)

---

<div class="post-metadata">

**Author:** ![cicero](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cicero](https://forum.logik.tv/u/cicero)\
**Post date:** [August 6, 2025, 11:41am UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/4 "2025-08-06T11:41:04Z")

</div>

@dazedinheaven Thanks for this great idea, I’ll explore it further.

---

<div class="post-metadata">

**Author:** ![cicero](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cicero](https://forum.logik.tv/u/cicero)\
**Post date:** [August 6, 2025, 11:43am UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/5 "2025-08-06T11:43:33Z")

</div>

@Jason_Chambers Thanks very much for taking the time to write this. It prints the expected info correctly, but unfortunately doesn’t actually perform an edit. It doesn’t throw an error, so I’m trying to work out why not.

---

<div class="post-metadata">

**Author:** ![Jason\_Chambers](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@Jason\_Chambers](https://forum.logik.tv/u/Jason_Chambers)\
**Post date:** [August 6, 2025, 12:12pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/6 "2025-08-06T12:12:56Z")

</div>

It’s a tried and tested one so should work, check video is patched and the sequence is open.

---

<div class="post-metadata">

**Author:** ![cicero](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cicero](https://forum.logik.tv/u/cicero)\
**Post date:** [August 6, 2025, 12:52pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/7 "2025-08-06T12:52:26Z")

</div>

Ah sorry, it is working 🙂 I hadn’t realised it’s actually overwriting into whichever sequence is listed first in the library, irrespective of whether it’s open or not. So hopefully I’ll be able to manipulate that to work just on the current active sequence instead.

Thanks again!

---

<div class="post-metadata">

**Author:** ![cicero](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cicero](https://forum.logik.tv/u/cicero)\
**Post date:** [August 7, 2025, 5:31pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/8 "2025-08-07T17:31:07Z")

</div>

Still stuck on this sequence thing. Sorry I realise this is basic stuff.

So `flame.project.current_project.current_workspace.libraries[0].sequences[0]` writes to the first sequence in the first library. How do I identify the current active record sequence, irrespective of where it sits in the libraries?

`flame.project.current_project.current_sequence` doesn’t seem to work.

---

<div class="post-metadata">

**Author:** ![PhilippeJ](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@PhilippeJ](https://forum.logik.tv/u/PhilippeJ)\
**Post date:** [August 7, 2025, 5:52pm UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/9 "2025-08-07T17:52:40Z")

</div>

flame.timeline.clip will return the PyClip/PySequence currently viewed in the timeline.

```auto
MasterSequence = flame.timeline.clip

```

The timeline could be showing the active sequence, current source clip, or an open container.

If you want to insure the timeline is showing the active sequence, you can do

```auto
flame.timeline.type = “sequence”
MasterSequence = flame.timeline.clip

```

---

<div class="post-metadata">

**Author:** ![cicero](https://avatars.discourse-cdn.com/v4/letter/c/ecae2f/32.png) [@cicero](https://forum.logik.tv/u/cicero)\
**Post date:** [August 8, 2025, 7:52am UTC](https://forum.logik.tv/t/basic-python-help-move-clips-to-timeline/13342/10 "2025-08-08T07:52:34Z")

</div>

Thank you @PhilippeJ - I would never have got to that
