The compiler always say in which line that error occured. So please post the line which the compiler doesn't "like".

What else you need to check:
Is the function defined _before_ you assign it to a key?