title: passing object to a job apscheduler as an argument for the function
body: <p>I try to pass an object as an argument to a job function with apscheduler.
  That's fine but in my case I'd like to change one of its value and use the updated value when the job is triggered.
  Here is my sample code</p>
  
  <pre><code>import time
  import sqlalchemy
  from apscheduler.schedulers.background import BackgroundScheduler
  from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore
  
  
  class MyClass:
      def __init__(self, *args, **kwargs):
          self.state = kwargs.get('state', "")
  
  
  jobstores = {
      'default': SQLAlchemyJobStore(url='sqlite:///sched.db', tablename='apscheduler_jobs')
  }
  
  scheduler = BackgroundScheduler()
  scheduler.configure(timezone='Europe/Paris')
  scheduler.add_jobstore(jobstores['default'], 'default')
  
  
  def myFunction(_internals):
      print("- in job")
      print(_internals.__dict__)
      print(".")
  
  
  if __name__ == "__main__":
      scheduler.start()
      myInstance = MyClass(state="off")
      print(myInstance.__dict__)
      j1 = scheduler.add_job(myFunction, trigger='cron', args=[myInstance],  second='*/10', max_instances=10, jobstore='default', srv_id="blablabla-x6548710")
      try:
          # This is here to simulate application activity (which keeps the main thread alive).
          while True:
              time.sleep(2)
              myInstance.__setattr__("state", "running")
              print(myInstance.__dict__)
      except (KeyboardInterrupt, SystemExit):
          print('exit')
          scheduler.shutdown()
  </code></pre>
  
  <p>Here is what I expect:</p>
  
  <pre><code>{'state': 'running'}
  {'state': 'running'}
  {'state': 'running'}
  {'state': 'running'}
  {'state': 'running'}
  in job
  {'state': 'running'}
  .
  {'state': 'running'}
  </code></pre>
  
  <p>But instead I have: </p>
  
  <pre><code>{'state': 'running'}
  {'state': 'running'}
  {'state': 'running'}
  {'state': 'running'}
  {'state': 'running'}
  in job
  {'state': 'off'}
  .
  {'state': 'running'}
  </code></pre>
  
  <p>Is there a way to have the same value in the while loop and the job at the time this one is triggered ?</p>
  
  <p>Thank you boys and girls</p>