ScriptInterface:SetSelLayer(layer, multiSelect, allowDeselect)

Version added: before 9.5

Changes which layer is selected in the Layers window

ArgumentTypeDescriptionDefaultVer
layerMohoLayerNew selected layer< 9.5
multiSelectboolIf false, all previously selected layers will be deselected.false< 9.5
allowDeselectbooltrue< 9.5

Return type : none

You also have to call ScriptInterface:UpdateUI to update display of Layers window.
If the layer is in the closed group You can call ScriptInterface:ShowLayerInLayersPalette to open the group and show the layer. This action includes updating UI too.