Setting new active scalar does not always show

In python I change the scalar of my new model. this works fine at first, but when I regenerate the model and scalar values it does not show directly the second time. In the model UI I see the correct scalar being selected, but I have to first select another and then back to the one I prefer to make the changes have effect. The scalar values must be correct and python code to select the scalar as well, but I think I am missing something. An update maybe?

modelDisplayNode.SetActiveScalarName(“Normal”) # do. this to make the new/next scalar to show
modelDisplayNode.SetActiveScalarName(“RGB”)

I already tried calling Modified for the scalarArray, modelNode and DisplayNode.

Yes, this sounds like a bug - can you adapt your code to make a short script that exactly replicates the issue (creates a model, sets the scalars, etc) to facilitate debugging?

You need to set up a few more things (enable scalar display, set range, color node, etc.) see example in this post. Let us know if you have still have issues.