“Consuming time” is a characteristic concept of hardware description languages. It requires a master scheduling kernel to keep all processes synchronized in time.
The SystemVerilog DPI lets you call a routine in another language and it can call back to another SystemVerilog routine which consumes time. At the moment, the only other language defined is C. But people have create wrapper interfaces for other languages like python. Here is one suggestion.