Please check that you don’t have any infinite loops running and that your code is not crashing at any point.
In your code, you have a line that reads:
while not i == 3:
That should be:
while i < 3
That said, you do not need to publish to the topics in a loop You should see how to publish once to a topic and make it work.