Use [Python's logging module](https://docs.python.org/3/library/logging.html) to control the display of messages to stdout instead of using print statements. I have an example way to do this I like here: https://github.com/nih-fmrif/osdash-ingress/blob/main/src/paper_clicker.py