Check the manual for panel->layer

Quote:

Determines the order of a panel, text, view, view entity, or sky entity, if it overlaps with other objects. Normally, elements with higher layer value will be placed over elements with lower layer value.

The layer parameter can only be set in a definition. For changing it during gameplay, use layer_sort