Widget Animation not starting when trying to do a simple loop

I have fixed my problem by adding a small delay before calling the play animation, Although a solution that could avoid this delay would be helpful
.