Question about setMasterIndex_

Hi! I’m trying to set via script the selected font master in a tab. Now im using setMasterIndex_() but is not what I really wanted, it selects the desired layer but it doesn’t change the button in the top bar, is more like changing the layer via the sidebar.

Any help on how to replicate via script the behavior after selecting the master using master buttons?

Thanks in advance!!

This is documented in the docu.glyphsapp.com

Font.masterIndex = 1

ohh sorry for such dumb question, when I created this thread I was reading the documentation, but I missed that line!! thanks and sorry again