Recent experimental studies have demonstrated that cellular motion can be directed by topographical gradients, such as those resulting from spatial variations in the features of a micropatterned substrate. This phenomenon, known as topotaxis, is especially prominent among cells persistently crawling within a spatially varying distribution of cell-sized obstacles. In this article we introduce a toy model of topotaxis based on active Brownian particles constrained to move in a lattice of obstacles, with space-dependent lattice spacing. Using numerical simulations and analytical arguments, we demonstrate that topographical gradients introduce a spatial modulation of the particles persistence, leading to directed motion toward regions of higher persistence. Our results demonstrate that persistent motion alone is sufficient to drive topotaxis and could serve as a starting point for more detailed studies on self-propelled particles and cells.