Cannot Hide Light with pvpython

Hello, I want to hide my light source programmatically (equivalent of doing Light → Show Light [disable] in GUI) with pvpython.

I have tried:

light1 = GetLight(0, renderView1)

which did not work. I am using 5.10, where this method is not deprecated yet (I have seen a deprecated warning on 5.11 here:
… where it says deprecated:: 5.11 Use HideInteractiveWidgets() instead)

I have also tried HideInteractiveWidgets, but it does not seem to be a defined keyword in 5.10.1 yet…

Then, I’ve tried just enabling the light and disabling it (as that would normally toggle off ‘Show Light’).
So I did as follows:

light1.Enable = 0
light1.Enable = 1

No effect. The light is still shown in my rendered view…

Finally, I tried just disabling the light altogether:

light1.Enable = 0

… and to my surprise, it still shows up in my rendered view!

NOTE: if I disable the light from inside the GUI, it works.
All these commands also work from the Python Shell.
But my plan to have a pvbatch script, and when when I run my script not interactively, it fails to turn off the ‘Show Light’.

Fascinating… The problem was that on the GUI, I had my Light Inspector (View → Light Inspector) turned on on the side. Once I turned it off, my script works as expected.

Also I can confirm this is not a problem when running with pvbatch, since there is no notion of a ‘Light Inspector View/Window/Panel’ there.

It seems that the Light Inspector overrides the script input.

Can you share exact steps to reproducce ? Im not able to reproduce here.

This post already has a solution. See Post #2 for a chance to reproduce it (seems like if you run your pvbatch script from GUI, and have the Light Inspector window/panel open, the pvbatch command does not work)