Is there any way to call python method in codeceptJS?

Hello everybody, I want to call python methods in codecept test case, for example , I write a method in file testlib.py

def loop():
n = 0
while n < 5:
n = n + 1
print('thread1 >>> ')
time.sleep(1)

Now I want to call this method in codeceptJS, is there any way to make it?

thanks!