# Python - Get Media Panel Selection

**URL:** <https://forum.logik.tv/t/python-get-media-panel-selection/8852>\
**Category:** Python\
**Tags:** python\
**Created:** [July 25, 2023, 8:55pm UTC](https://forum.logik.tv/t/python-get-media-panel-selection/8852 "2023-07-25T20:55:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thoma](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Thoma](https://forum.logik.tv/u/Thoma)\
**Post date:** [July 25, 2023, 8:55pm UTC](https://forum.logik.tv/t/python-get-media-panel-selection/8852/1 "2023-07-25T20:55:16Z")

</div>

How does one get the current selection from the media panel? For example, all the scripts from pyFlame pass ‘selection’ as an argument to their class methods but they’re not defining directly what the selection is. I’m assuming whatever right click wrapper function control the Python hooks does that but - how can I do it directly?

In nuke it’s very simple:

nuke.selectedNodes() gives a list of all nodes selected in the node graph.

Surely there’s a direct way in the Flame API to do the same for Media Panel selections?

---

<div class="post-metadata">

**Author:** ![MikeV](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/mikev/32/399_2.png) [@MikeV](https://forum.logik.tv/u/MikeV)\
**Post date:** [July 25, 2023, 9:07pm UTC](https://forum.logik.tv/t/python-get-media-panel-selection/8852/2 "2023-07-25T21:07:50Z")

</div>

Whenever you do a right-click a selection is always returned. The selection will always be a list of whatever gets right-clicked on. A selection of nodes, a segment, a folder…

Mike

---

<div class="post-metadata">

**Author:** ![Thoma](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Thoma](https://forum.logik.tv/u/Thoma)\
**Post date:** [July 25, 2023, 9:31pm UTC](https://forum.logik.tv/t/python-get-media-panel-selection/8852/3 "2023-07-25T21:31:02Z")

</div>

Hey Mike,

Is there a global variable called ‘selection’ then? I’m trying to call it directly in the python console - not hard coding it into a persistent custom menu.

---

<div class="post-metadata">

**Author:** ![knhn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.logik.tv/knhn/32/5635_2.png) [@knhn](https://forum.logik.tv/u/knhn)\
**Post date:** [July 25, 2023, 10:28pm UTC](https://forum.logik.tv/t/python-get-media-panel-selection/8852/4 "2023-07-25T22:28:58Z")

</div>

its tucked in the flame module. i dont _thiiiiink_ its in the documentation.

`flame.media_panel.selected_entries` returns a list of the selected objects

NOTE - its an attribute. not a function you have to call.

---

<div class="post-metadata">

**Author:** ![Thoma](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Thoma](https://forum.logik.tv/u/Thoma)\
**Post date:** [July 25, 2023, 11:19pm UTC](https://forum.logik.tv/t/python-get-media-panel-selection/8852/5 "2023-07-25T23:19:34Z")

</div>

Brilliant - that’s what i was looking for. Thanks, Kieran
