This function doesn’t seem to be the same as the sleep function because it stops motors after the wait is over. So what does the function do exactly
It pauses execution of the thread in which it is invoked for the specified number of milliseconds. If your motors are stopping, that will be some other part of your code doing that. Or the end of your program stopping them.