Python 101 - delete library

Hi all,

Flame user of 10+ yrs but new to the forum and it’s great what you’re doing here!

Total newbie with python scripts and I’m just starting with some real basics, like creating a bespoke set of libraries and subfolders in a fresh project. I think I’ve nailed it (thanks to @andymilkis and @fredwarren for Logik Live Ep #07)… apart from deleting the automatically-generated Default Library. Any pointers please?



Welcome Franz! Glad you enjoyed Ep 7! It seems like forever ago…this Sunday is #65 :slight_smile:

Here’s how I solved it:

At the top of the script I defined the existing default library that is created with a new project:

default_library = ws.libraries[0]

Then at the end of my script I have this to remove the default library:

if “Default Library” in str(



1 Like

The default library could probably be at any index. I would either iterate over all libraries to find it or use the build in function from the flame module to find it.

Find by iterating over all libs:

for lib in flame.project.current_project.current_workspace.libraries:
    if == "Default Library":

Find by using the flame module’s function:

for lib in flame.find_by_name("Default Library"):
    # make sure we are really dealing with a lib and not any other item that is just called "Default Library"
    if isinstance(lib, flame.PyLibrary):

Find by name reference:


By using you will directly get a string instead of a flame.PyAttribute and don’t need to do a conversion. :slight_smile:


Thanks both. Out of the 3 options I could only get the iteration over all libs working, but that’s done it!
When I get more time I’ll work out how to make the other options work. It’s pretty heavy going when you’re this new to python.
Thanks again

1 Like

Let us know what errors you get and we can help. :slight_smile:

1 Like

Hi all,
I have a similar request, I’m hoping to get the library name that contains the sequence I’m exporting to use in the file path.
Tried all variations on current library but no joy.
Any ideas?

Hey Jason,

PySequences do have a parent attribute, but I think this will only help you if the selected clip is in the library:

If the sequence is on your current desk and you want to find the library where it has also been saved you probably need to crawl all libraries to find the sequence. Have a look at this code snippet which shows you how to collect clips from libraries with an unknown level of subfolders:

Instead of just adding every clip (clips.append(clip)) you would add a check if the clip name equals your clip name.

Thanks for you help Claus,
The clip will always be in a library.
Had a look at the link and can return lots of sequence info but don’t see any way to get which library its saved in.

Did you try to use the parent attribute as mentioned before?

Select your sequence in the media panel, run this and you will see the libraries name printed:

for item in flame.media_panel.selected_entries:

Amazing, thanks so much

You’re welcome! :slight_smile:

Thank you!!