Refresh from Sub-Projects

refresh_from_sub_projects re-reads every sub-project's connector pins and computes the diff against the current MBS contents. The same diff drives the desktop "MBS Refresh" dialog.

Two-step pattern

The recommended flow is dry-run first to preview, then apply:

mbs = kicad.get_mbs_schematic()

# Step 1 — preview the diff
preview = mbs.multi_board.refresh_from_sub_projects(dry_run=True)

print(preview.summary)

for change in preview.proposed_changes:
    print(f"  [{change.kind}] {change.detail}")

Each proposed_changes[] entry is indexed; pass a subset of those indices to apply only some.

# Step 2 — apply everything
result = mbs.multi_board.refresh_from_sub_projects(dry_run=False)

# ...or apply only specific entries
result = mbs.multi_board.refresh_from_sub_projects(
    dry_run=False,
    apply_indices=[0, 2, 5],
)

When apply_indices is None or empty, every change is applied.

Response fields

FieldMeaning
dry_runEchoes the request mode
proposed_changesThe full diff list, indexed
blocks_added / blocks_removedCounts (zero in dry-run mode)
pins_added / pins_removed / pins_renamedCounts
paths_updatedSub-project path entries updated on the MBS
uuids_stampedNewly-stamped sub-project UUIDs
summaryHuman-readable summary

When to call

Run after editing a sub-project's schematic: adding or removing connectors, renaming pins, or moving sub-projects on disk. Then sync_to_pcb to propagate the resulting net edits to PCBs.