How to make if statement if there is solidify modifier

Hi,
I made a menu but need to add an if statement. Part of the menu should only show up if the object has the solidify modifier “Solidify”.

Script is working, and error is harmless, but would like to get rid of all errors :

row.prop(context.object.modifiers["Solidify"], "thickness")

KeyError: ‘bpy_prop_collection[key]: key “Solidify” not found’

How to make such an IF statment?

If you want to check by name :

if "Solidify" in context.object.modifiers :
has_solidify = False
for modifier in object.modifiers:
     if modifier.type == "SOLIDIFY":
         has_solidify = True
         break

if has_solidify:
    ...  # your code

That’s quick, Thanks for quick reply.
I will check if following works;

    if context.active_object is not None and context.object.type =='CURVE'  and "Solidify in context.object.modifiers" :

This will not work if

  • the user has renamed the solidify modifier
  • the user has added more than one solidify modifier, but then deleted the first (the others will be named “Solidify.001” etc.)

Hi, thanks,
Awesome support. I will try it out.

@B.Y.O.B @DoubleZ1

Both solutions worked, but can only tag one as solution it seems.
Thanks!