Set Active Layer

How can I programmatically set the active layer? Selecting by either name or index is fine with me, I’m just not sure how to do this.

I figured it out! sprite.layers[index] worked out for me!