How to enable the scalar bar for the foreground layer from Python terminal?

Hi everyone!!!

I’m trying to enable the scalar bar for the foreground layer from Python terminal.

Does anyone have idea how to set this?

Here is an example:


Please note that for you things will be a bit simpler because in this example a separate layout manager is used, and you won’t have to create one like this.