Order point based on x and y

Hi, i have a list with multiple sub-lists which contain point (coordinates). I’m trying to order them first by x and then by y (see attached screenshot).

The script seems to work except the x values in the last list go from large to small (if the y value is the same) and i need it the other way around. I cant seem to figure out how to achieve this.

I know there are a lot of similar topic to this one but cant find the answer.

You need to sort and group, otherwise you’re just reordering the list each time. Sort by x then group by x. Then you can sort those sublists by y.

Thx, this was indeed the issue. Here is the script for anyone running into the same problem;