Building complex functionality in Kite is really all about connecting scripts and actions. Scripts can provide the base logic and functionality for your more complex features, and actions are perfect for driving any sort of gestures or interactive features. It's really a similar structure to how things are built in code - gesture handlers often call other functions and parts of the code to accomplish tasks.
If you write a function in a script, and it starts on line 1, Actions will not be able to see it. The current workaround I've found is just to make sure there's at least one line of text or whitespace above any functions in your script. If you don't delete all the boilerplate comment code, you'll never encounter this though.