How can I use Python in KiCad to script the routing of tracks between component pads?
To script the routing of tracks between component pads in KiCad using Python, you can define a function that adds tracks to the board. The script provided demonstrates this by routing a track from pad #1 of footprint 'R1' to pad #1 of 'D1':

```python
import pcbnew
from pcbnew import wxPoint, wxPointMM

def add_track(start, end, layer=pcbnew.F_Cu):
    board = pcbnew.GetBoard()
    track = pcbnew.PCB_TRACK(board)
    track.SetStart(start)
    track.SetEnd(end)
    track.SetWidth(int(0.25 * 1e6))
    track.SetLayer(layer)
    board.Add(track)

board = pcbnew.GetBoard()
start = board.FindFootprintByReference('R1').FindPadByNumber('1').GetCenter()
end = board.FindFootprintByReference('D1').FindPadByNumber('1').GetCenter()
offset = end.x - start.x
thru = pcbnew.wxPoint(start.x, end.y - offset)
add_track(start, thru)
add_track(thru, end)

pcbnew.Refresh()
```

This script is useful for automating the track routing process, particularly for complex PCB designs where manual routing would be time-consuming.