I’m curious about the behavior of PyMC here generally, but in your specific model, why do you need the dist at all? It seems like this should work fine, because the parameters of the distributions aren’t actually changing in the scan:
σlog = tt.sqrt(tt.log((σ / μ)**2 + 1))
μlog = tt.log(μ) - σlog**2 / 2
log_norm = pm.Lognormal(mu=μlog, sigma=σlog)
π, _ = ae.scan(lambda t: tt.exp(pm.logcdf(log_norm, t + 0.5)) - tt.exp(pm.logcdf(log_norm , t - 0.5)),
sequences = [tt.arange(0, D + 1)])