How to enable / disable the Environment Lighting option of the World panel in Python?

Does anyone know how to enable / disable the Enviroment Lighting option in the World panel on the UPBGE? I tried the following code but it didn’t work or gave an error on the console.

from bge import logic, events
controller = logic.getCurrentController()
owner = controller.owner

keyboard = logic.keyboard.inputs

if keyboard[events.BKEY].values[-1]:
    WorldLighting.use_glsl_environment_lighting = False

KX_WorldInfo(EXP_PyObjectPlus)

from bge import logic, events
#controller = logic.getCurrentController()
#owner = controller.owner

scene = logic.getCurrentScene() # your scene
world = scene.world # the world in your scene

keyboard = logic.keyboard.inputs

if keyboard[events.BKEY].values[-1]:
    
    world.envLightEnergy = 0.0 # the environment lighting energy set to 0

##### --- other variables...

#    world.exposure = 0.5
#    world.range = 0.3
    
#    world.mistColor = (0.0,1.0,0.0) # turn mist green
#    world.ambientColor = (1.0,1.0,0.0) # ambient color into yellow
#    world.horizonColor = (1.0,0.0,0.0,1.0) # horizon color into red
#    world.zenithColor = (0.0,0.0,2.0,1.0) # sky blue :)


#    world.backgroundColor = (0.4,0.7,0.9)
#    world.mistDistance = 800.0
#    world.mistStart = 25.0

If you get an error, post the error too. It’s sort of useful when trying to come up with a fix.

What? Where did you get that from?

You want KX_WorldInfo http://shuvit.org/python_api/bge.types.KX_WorldInfo.html#KX_WorldInfo

The environment light can’t be disabled directly though (I think), you could try turning the energy down to zero.

world = own.scene.world
world.envLightEnergy = 0

And you might have to disable constant settings for world on your materials for any changes to take effect. Like so, in material tab of properties panel.

bpy code pops in the UI i think.