Material settings - blender crashes

Not quite sure what I’m doing wrong here, I’m (hopefully) making a script that will add a material node setup that I use a lot, and could do with automating:

bpy.types.Material.use_nodes = True

Does nothing.

bpy.types.Material('Material').use_nodes = True

Crashes blender :stuck_out_tongue:
I would be immensely greatful if someone could help me around this problem, and maybe somehow let me know how to substitute ‘Material’ for the selected material?

If you haven’t guessed, I’m very new to the whole coding thing…

Many thanks.


Thanks, This is indeed a valuable resource :smiley: