Home/ Reference/ Layer Advanced

layer.MoveAbove(OtherLayer) / MoveBelow(OtherLayer)

Reorders layers. The text layer has to sit on top or images cover it — set it explicitly in the script and you won't get caught out.

Signature

layer.MoveAbove(OtherLayer) / MoveBelow(OtherLayer)

Notes

Reorders layers. The text layer has to sit on top or images cover it — set it explicitly in the script and you won't get caught out.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
text_layer = page.Layers.Item(1)                    # say layer 1 is the text layer
top_layer = page.Layers.Item(page.Layers.Count)

try:
    text_layer.MoveAbove(top_layer)                 # bring the text layer to the top
    print("Text layer moved to the top")
except Exception as e:
    print("Reordering layers failed: ", e)

About this section: Layer Advanced

Layer Advanced — multi-layer and multi-page workflows.

Other entries in this section