Leaving an APScheduler in a while True loop
while True: pass will consume 100 % of one CPU which is not something you want. I'm not familiar with APScheduler, but a quick look into the docs reveals a daemonic option:


  Controls whether the scheduler thread is daemonic or not.
  
  If set to False, then the scheduler must be shut down explicitly when
  the program is about to finish, or it will prevent the program from
  terminating.
  
  If set to True, the scheduler will automatically terminate with the
  application, but may cause an exception to be raised on exit.