If what you shared is a working example, then, you could do:
# wait for the old message to be unloaded
expect(old_message_element).toBeHidden()
then continue with what you wrote:
answer_input = page.locator("#message textarea[name='answer']")
....