I don't have enough reputations to write a comment guiding you to existing solutions for your questions, so here's an answer in case you still haven't found the solution or for someone who stumbles upon this question looking for a solution.
Also, it'd be better if you provide some code, so we can see what you are trying to do with that dataframe, and understand what you mean by this part:
How do I ensure that I am accessing and changing the dataframe in global df?
You can use global or session or a function returning the dataframe or by pickling, here are few examples:
Returning df:
def get_dataFrame():
df = pd.read_csv("some_data.csv")
return df
Using global:
def define-df():
global df
df = pd.read_csv("some_data.csv")
return "something"
def process-df():
//do something with this df
return "something"
Now you might run into error using global for a dataframe (I never get it to work), and it's not recommended to use global anyway, so you can better use session depending on your dataframe.
Using session:
def define-df():
df = pd.read_csv("some_data.csv")
session['DF'] = df
return "something"
def process-df():
df = session['DF']
//do something with this df/session['DF']
return "something"
Here's a que-ans which can give you a better perspective on how to use session for using variables/df across methods.