Condition "if" statement to change render engine modes I wanted to change the cycles render to Blender internal through a panel button but only want the panel button to appear only when the current render engine is cycles. How do I create the conditional statement ?

Here the code I'm trying but it's not working:

if context.scene.render.engine == {'CYCLES'}:
      layout.operator("mesh.primitive_cube_add")
You don't want the curly braces around the string.

if context.scene.render.engine == 'CYCLES':
    layout.operator('render.set_internal')


Note that cycles and blender internal are not the only choices for render engine. It would be better to test if blender internal is the current engine.

if context.scene.render.engine != 'BLENDER_RENDER':
    layout.operator('render.set_internal')
else:
    layout.label(text='Blender render is active.')