Make function scriptable