How can paint in between small panes in a window without messing up the glass?

My front window has 15 dmall panes of glass. The wood surrounding the panes need painting bad. How can paint in between the small panes in a window without messing up the glass too bad? any ideas or suggestions?