Access layer by its name

Short question. Is possible to access to a layer by its name?

Best regards

How can I delete this post? I’ve found the solution was obvious :joy:

You can only delete your comments, but not the thread itself.


We can. But we will leave it up for reference:

EDIT: removed, see Georg’s post below.

Maybe someone else stumbles across the same problem. More about the Python API of Glyphs.

I don’t think this works. It only accepts indexes and LayerIDs. You can use something like this:

for layer in myGlyph.layers:
    if == "layer name":
        myLayer = layer

but I would suggest this:

master = Font.masters[IndexOfMasterYouNeed]
myLayer = myGlyph.layers[]

Thank you all.