How can I use Python to add a custom footprint with pads to my PCB in KiCad?
Adding a custom footprint with pads to a PCB in KiCad can be done using Python scripting. The script snippet provided demonstrates how to create a new footprint, set its position, and add a pad to it with specific attributes like size, shape, type, and drill size:

```python
import pcbnew

# Initialize PCB and create a new footprint
board = pcbnew.GetBoard()
module = pcbnew.FOOTPRINT(board)
module.SetPosition(pcbnew.wxPointMM(x, y))
board.Add(module)

# Create and configure a pad for the footprint
pcb_pad = pcbnew.PAD(module)
pcb_pad.SetSize(pcbnew.wxSizeMM(pin_diameter, pin_diameter))
pcb_pad.SetShape(pcbnew.PAD_SHAPE_CIRCLE)
pcb_pad.SetAttribute(pcbnew.PAD_ATTRIB_PTH)
pcb_pad.SetLayerSet(pcb_pad.PTHMask())
pcb_pad.SetDrillSize(pcbnew.wxSizeMM(pin_drill, pin_drill))
pcb_pad.SetPosition(pcbnew.wxPointMM(x, y))
pcb_pad.SetNetCode(net.GetNetCode())
module.Add(pcb_pad)
```

This approach is useful for creating custom footprints in a PCB layout, especially when standard footprints do not meet the specific requirements of the design.