Suppose we have a time varying potential $$\left( -\frac{1}{2m}\nabla^2+ V(\vec{r},t)\right)\psi = i\partial_t \psi$$ then I want to know why is the general solution written as $\psi = \displaystyle\sum_n a_n(t)\phi_n(\vec{r})e^{-iE_n t} $ Particularly, why do we get a time dependent coefficient $a_n(t)$. This confuses me because when we have a time independent potential, then we use variable separation and usual method to get the general solution $$\psi = \displaystyle\sum_n a_n\phi_n(\vec{r})e^{-iE_n t}$$ However, the time varying counterpart cannot be reduced this way by variable seperation.
EDIT: I could not find a free preview of the book I am using, however, the lectures here for example, use the same solution.