Hi,
Please check this 323 section of the doc explaining how to create custom functions. In particular new style functions use static method and no inits.
If you still have problems, please post your full code so that we can look into it !