RooFit plays fast and loose with the meaning of ‘const’. This often works okay by accident in C++, but life time ordering is different in Python, breaking things. B/c of that alone, I can’t recommend using RooFit from Python. Not unless someone goes through the implementation and annotates all python functions, that is.
Anyway, b/c of your loop, the life time of var_eta and var_set differ from v_var_set. Either tell Python not to delete them (using “ROOT.SetOwnership(var_eta, False)” etc.), or store them in a python container for the same life time duration as v_var_set.