Custom modifier settings from UI button

I’ve been trying to create some basic shortcut buttons for actions I perform a lot in Blender.
I have a custom panel in the 3D view with a collection of buttons that perform various basic actions.

However, one thing has eluded me so far which I would like to get working.

For example, I have a button that adds a Dynamic Paint modifier like so:


row.operator("object.modifier_add", text="DP Canvas VW", icon="MOD_DYNAMICPAINT").type='DYNAMIC_PAINT'

What I would like to do is pass along a few settings to it like set it to Canvas and Vertex Weight mode.

How do I add in those properties to the button?

My Python knowledge is pretty basic, so any push in the right direction is appreciated.

class maClass(bpi.type.operator):    
    bl_idname = XXXX

    def execute(self, context):
        Do what you want here!
        context.object.modifier_add(type='DYNAMIC_PAINT')



class Ui_Class(bpy.type.Panel)

    def draw(self, context):
         row.operator(maclass.bl_idname, text="DP Canvas VW", icon="MOD_DYNAMICPAINT")

Thanks, didn’t realize I had to create a separate class for it.
I was trying with just functions and getting nowhere.

Yes and in your class you can add poll() and check() fonctions and may be init() too…if you want.
Poll() is very important.
Byebye