import array
import multiprocessing as mp
from apscheduler.schedulers.blocking import BlockingScheduler

class Scheduler(BlockingScheduler):
    """
    The class extends and configures the BlockingScheduler into a new process.
    """
    def __init__(self, name: str, days: int, function, args: array = []) -> None:
        super().__init__()
        self.name = name
        self.add_job(func=function, args=args, trigger="interval", days=days)

    def run(self):
        mp.Process(name=f"Scheduler ({self.name})", target=lambda: self.start()).start()