Using browser development tools see if you can call the function manually from the console. If you still get Function not defined then do the following:
- Check for typos
- If you use a master page, make sure you are not placing the reference of the script page inside the container tags (which get overwritten with the actual page content, this is from personal experience lol)
- Clear your cache and reload the page