I am trying to create a class which allows users to create a custom button object, which holds the button's appearance attributes, as well as a function, which I want to be able to then run when I call the button's executeFunction() command.

```
def foo():
    print "bar"

class Button(object):

    def __init__(self, name, color, function):
        self.name = name
        self.color = color
        self.function = function

    # I want to be able to run the function by calling this method
    def executeFunction(self):
        self.function()

newButton = Button("Example", red, foo())
newButton.executeFunction()

```

Is this the correct way, or is there a specific way to perform this kind of action?