loopfunction

A small python module for running functions in an infinite loop


Keywords
loop, function, thread, serve, forever
License
MIT
Install
pip install loopfunction==1.1.4

Documentation

loopfunction

Makes it easy for one function to go into an infinite loop

installation

pip install loopfunction

Basics

import loopfunction
from time import sleep

def function(x):
    print(x)
    sleep(2)

loop_obj = loopfunction.Loop(target=function, args=('Hello, World!',))
loop_obj.start()

This will output

Hello, World!
Hello, World!
Hello, World!
...

To stop

loop_obj.stop()

For a more in deapth explanation of each function see the docstrings in loopfunction.py