Flipping a footprint to the back layer with pcbnew's Python API

Published on September 15, 2026 by leZ

Move a footprint from the front to the back layer of the PCB by script, for a component mounted on B.Cu — with pcbnew or KiCad's IPC API.

On a double-sided PCB, some components — often small passives — get mounted on the back copper layer to save space up front. Flipping a footprint by script skips the context menu for every component that needs turning over.

Flipping the footprint

Flip mirrors the footprint around a given centre — usually its own position, for an in-place flip:

fp = board.FindFootprintByReference("U1")
fp.Flip(fp.GetPosition(), True)

With the IPC API, you assign the target layer to the footprint directly:

by_ref = {f.reference_field.text.value: f for f in board.get_footprints()}
fp = by_ref["U1"]
fp.layer = "B.Cu"
board.update_items(fp)

Try it below: flip the footprint and watch how its orientation and layer color change.

fp.Flip(fp.GetPosition(), False)

Front layer

U1

Going further

After a Flip, check that through-hole pads stay aligned and the reference text stays legible — on the back layer, KiCad typically mirrors the text so it still reads correctly once the board is physically turned over.