Python: help with create_sequence

Hi, sorry but more beginner’s help with python needed please.

I’m trying to write a simple hook to create an empty sequence in an existing library. Then add extra tracks and versions, name the tracks etc, to follow house conventions.

Despite going through all the usual resources I can’t get the syntax right for the “create_sequence” function. Exactly how does it all need to be arranged?

Also if I try to run it, nothing happens and the shell says
failed because of an error of type ‘Width should be even and between 24 and 16384.’
…even though I’m defining a width of 3840 and height of 2160.
This may be because my syntax isn’t presenting the width value correctly… but then it’s formatted in the same way as earlier attributes, so if it’s the syntax, why isn’t the error showing on a previous line?

TIA! (1.2 KB)

I think you might be mixing Arguments and Attributes. Width & height are arguments that have to be passed to creation of the PySequence object using the PyLibrary method like item.create_sequence(width=3840, height=2160). But then name is an attribute that could be changed after creation like you are doing there with

Tested and working. No colour argument on my version of Flame, so commented out. And no nicknames present over here so changed to just project name. (1.0 KB)

Thanks so much… brilliant.
Yes you’re right, I’m still not clear on Arguments vs Attributes (as well as most other things). But this is great to help illustrate the difference.
And I had a little bit of what @andymilkis calls Bracket Hell.

Thanks again.

1 Like

An attribute is something you can get and set.
An argument is what you pass to a function to set one of its parameters.

Attributes example

In flame.batch.current_node.get_value().name = “New Name”, name is an attribute of a PyNode

Argument example

In flame.batch.create_batch_group() you can pass the following arguments: name, nb_reels, nb_shelf_reels, reels, shelf_reels, start_frame and duration.

1 Like

Thanks for clarifying Fred.