How to setup a timer in a python script?

I’m trying to delay the execution of my code in a python script.

import unreal

timer_delegate = unreal.TimerDynamicDelegate()

def delayed_action():
    print('Do it!')

timer_delegate.bind_callable(delayed_action)

unreal.SystemLibrary.set_timer_delegate(timer_delegate, time=3, looping=False)

For some reason I get:

RuntimeWarning: SystemLibrary: No world was found for object (/Engine/Transiernt.TimerDynamicDelegate__PythonCallable_4) passed in to UEngine::GetWorldFromContextObject().

What’s the problem? Please, show a correct way to do it.