I am trying to disable all collections in the render with python in Blender 2.8
It works on top-level collections with the code below, but ignores nested collections.
import bpy
coll = bpy.context.view_layer.layer_collection
for x in bpy.context.view_layer.layer_collection.collection.children:
x.hide_render = True
Is there a way to get all collections, regardless of hierarchy?