Have you checked that the module is indeed loaded?...
# suitescript
i
Have you checked that the module is indeed loaded? Is it a long function? if not, you can generate it on the sever side and set it on the button, this is how I usually do it.