How make tree component select a specific item by script

I try to force component tree to select a specific item by changing the props.selection[0] property in a button script.
But it seems it doesn’t work. I find out when I change the value in designer and then press button it works and make item selected.
I also delete property and recreate again in button script to trigger this functionality but it doesn’t work neither.

That is strange. adding an onClick event to a button to change the props.selection[0] property of a tree component works in the designer in preview mode, but not initially in a proper session. I was only able to get the button to work by first selecting another item in the tree, then clicking the button.

Yes that’s the problem only you can change selection by script if user change it my mouse before for only one time.