Blender 2.92 on Win 10 20H2, Intel i7-8700K CPU, GTX 1080, 32 GB ram
The Python console shows this action on enabling the "Denoising Data" checkbox in "Layer properties"->Passes:
bpy.context.scene.denoising_store_passes = True
PROBLEM:
using this in a script throws this error:
NameError: name 'scene' is not defined
Error: Python script failed, check the message in the system console
How to redo the bug:
start an new scene
navigate to : Layer properties->Passes->Data
(un)check the Denoising Data checkbox
copy the output from the Python console into a new script like:
import bpy
bpy.context.scene.view_layers["View Layer"].use_pass_mist = True
execute script
watch the error appearing in the system console