In Godot 3,
modulate is a property. You can set it from a script by writing
modulate = Color(0,1,0). There is no example of how to set it because we would have to write one for every single property of every class, so instead you should learn how properties work. They are just like variables that have internal getter and setters (so you can use
set_modulate(Color(0,1,0)) too) but it's just easier to use the property shortcut.
modulate = Color(0,1,0)
# If MySprite is a child
get_node("MySprite").modulate = Color(0,1,0)
Note: in Godot 2 properties did not exist so you could ony use