How to get list footprint Reference Designators KiCAD pcbnew plugin Python API

When you have a FOOTPRINT object or a list of footprints in KiCAD’s Python API such as from board.GetFootprints(), you can get their reference designators such as C11 or R4 using

footprint.GetReference()

Complete plugin example:

#!/usr/bin/env python
import pcbnew
import os

class SimplePlugin(pcbnew.ActionPlugin):
    def defaults(self):
        self.name = "Plugin Name as shown in Pcbnew: Tools->External Plugins"
        self.category = "A descriptive category name"
        self.description = "A description of the plugin and what it does"
        self.show_toolbar_button = False # Optional, defaults to False
        self.icon_file_name = os.path.join(os.path.dirname(__file__), 'simple_plugin.png') # Optional, defaults to ""

    def Run(self):
        board: pcbnew.BOARD = pcbnew.GetBoard()
        footprints: list[pcbnew.FOOTPRINT] = board.GetFootprints()
        
        # TODO Do something useful with [board]
        for footprint in footprints:
            print(footprint.GetReference())

SimplePlugin().register() # Instantiate and register to Pcbnew