When working with panel data, many researchers wish to estimate the direct effects of time-varying factors on future outcomes. However, when a baseline treatment affects both the confounders of further stages of the treatment and the outcome, the estimation of controlled direct effects (CDEs) using traditional regression methods faces a bias trade-off between confounding bias and post-treatment control. Drawing on research from the field of epidemiology, in this article I present a marginal structural modeling (MSM) approach that allows scholars to generate unbiased estimates of CDEs. Further, I detail the characteristics and implementation of MSMs, compare the performance of this approach under different conditions, and discuss and assess practical challenges when conducting them. After presenting the method, I apply MSMs to estimate the effect of wealth in childhood on political participation, highlighting the improvement in terms of bias relative to traditional regression models. The analysis shows that MSMs improve our understanding of causal mechanisms especially when dealing with multi-categorical time-varying treatments and non-continuous outcomes.