  In this paper, we establish an asymptotic formula for the twisted second
moments of Dirichlet $L$-functions with one and two twists when averaged over
all primitive Dirichlet characters of modulus $R$, where $R$ is a monic
polynomial in $\mathbb{F}_q[T]$. The main result in this paper generalizes the
work of Djankovi\'c [`The reciprocity law for the twisted second moment of
Dirichlet $L$-functions over rational function fields', Bull. Aust. Math. Soc.
98 (2018), no. 3, 382--388].
