title: Advanced Python Scheduler: call a function in the class
body: <p>This is my script. I'm trying to call a function from another class.</p>
  
  <pre><code>class example:     
    def test(self,txt):
      print(txt)
  
  class myscheduler:
    def __init__(self):
      self.scheduler.start()
  
    def add_job(self, date, txt):
      t=example()
  
      trigger = DateTrigger(
          run_date=date
      )
  
      job_kwargs = {
        'trigger': trigger,
        'func': t.test,
        'kwargs': {'txt':txt},
        'id': 'task-{}'.format(txt),
        'name': 'Task({})'.format(txt),
        'coalesce': True,
        'max_instances': 1
      }
  
      self.scheduler.add_job(**job_kwargs)
  </code></pre>
  
  <p>But this is the error</p>
  
  <pre><code>TypeError: test() missing 1 required positional argument: 'self'
  </code></pre>
  
  <p>Even if test function is inside myscheduler class</p>
  
  <pre><code>def add_job(self, date, txt):
    trigger = DateTrigger(
        run_date=date
    )
  
    job_kwargs = {
      'trigger': trigger,
      'func': self.test,
      'kwargs': {'txt':txt},
      'id': 'task-{}'.format(txt),
      'name': 'Task({})'.format(txt),
      'coalesce': True,
      'max_instances': 1
    }
  
    self.scheduler.add_job(**job_kwargs)
  
  def test(self,txt):
    print(txt)
  </code></pre>
  
  <p>What's is the problem?
  Must I pass a self argument? How?</p>