I solved my problem, but without using a helper function. here is how I solved it:
$(window).on('action:topic.loaded', function (event, data) {
var replynum = data.postcount - 1;
console.log(replynum)
});
I have tested it and it works, every time a topic is loaded I can get the postcount.
However, I am still unable to know why my helper function is not being executed