No, you need to change the function to replace both the comment and the following number (if any), like this:
search expression
<!-- comment# -->(\d*)
function
Code:
def __call__(self, match):
self.number += 1
return '<!-- comment# -->' + str(self.number)
Then you can run it as many times as you like, each time the number will ge generated fresh.