title: How to share a variable between threads?
body: <p>I have a dataframe, df, that starts out empty. Then I have a while loop which runs through adding rows. Separatly, using APSchedule, I'm running some calculations on the dataframe every minute in a different thread. But the calculations seem to be running on the empty df, not the one where I've added rows in the while loop. How do I make APSchedule use the correct dataframe, from the while loop?</p>
  <pre><code>    import pandas as pd
      from datetime import datetime # used to get current time
      from Functions4 import *
  
  
      df = pd.DataFrame()
      theSchedule(runCalculations,df,BRlist)
  
      connected = True
      while connected:
              row = pickle.loads(conn.recv(row_length)) # recuve data from client
              df = rowAdder(df,row) # Adds new row recived from client
  </code></pre>
  <p>where</p>
  <pre><code>everyMin = 1
  def theSchedule(function, arg1,arg2):
      scheduler = BackgroundScheduler()
      scheduler.add_job(function,
                        'cron',
                        args=(arg1,arg2), # arguments to pass into the function
                        minute='*/{}'.format(everyMin))
  
      scheduler.start()
  </code></pre>
  <p>and</p>
  <pre><code>def rowAdder(dataframe,newRow): # adds newRow to dataframe
      dataframe = dataframe.append(newRow, ignore_index=True)
      return dataframe
  </code></pre>
  <p>and runCalculations takes in a dataframe, and a list, and does some maths to the dataframe</p>