Programing question.


Hello. I'm trying to start to program for NVDA. i'm new with codes for NVDA, but i know How to program using python. 
My question is:
I was testing how get spoken messages using the ui.message function, but the problem is when i try some code like this.

import ui

ui.message('hello, this is a basic test.')

Then i press intro key waiting for the message, but NVDA just try to speak and stop in less than one second leaving the message without finish.

But then i add a sleep(1) after and the message is finally read.

import ui
from time import sleep

ui.message('hello, this is a basic test.')

Of Course, this is the bad way to do.
How can i get the message read without sleep NVDA?
I'm sure there is a way to, but i not familiar with NVDA parameters.E

Join to automatically receive all group messages.