Rearrange layers?

Is there a way change layer position in the list without creating new layer?

I have a list or layer names that I want to have in a specific order.
If file doesn’t have any of these layers it works well, all layers added in proper order, but if a layer already exists, it stays in its original position.
My current method is renaming existing to a temp name, create new layer with that name, and move existing objects from old layer to new. This works, but it’s messy, slow and not 100% proof.

Thank you.

Thank you. Unfortunately, it seems SortIndex is read-only property

@vano_artful - use the Sort method on the Layer table.

– Dale

@dale Thank you! It worked