New to bpy and I'd like to write some code that sets the shading of an object to smooth by just clicking a button. I did some research and I have written the following lines for now:
import bpy
def draw(self, context):
layout = self.layout
row = layout.row()
row.operator(" bpy.ops.object.shade_flat()")
row = layout.row()
row.operator(" mesh.object.shade_smooth()")
I assume that I would have to add some other lines in order to register the class and all that right? Anyway, the problem is that the code does not work. Is this the way it is supposed to work at all?
Q: What's the correct way to call this function when pressing a custom button?