Making uploaded dataframe available globally

I want to shift column_dropdown code into the app.layout for which I need to make df in parse_data available globally in order to use df in app.layout.
In short it is like declaring df at the top before app.layout

import base64
import datetime
import io
import plotly.graph_objs as go
import cufflinks as cf
import chart_studio as py
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot

import dash
from dash.dependencies import Input, Output, State
from dash import dcc
from dash import html
from dash import dash_table
import json
import pandas as pd
import xlrd
import openpyxl
import as px
import as pio
external_stylesheets = [""]

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
server = app.server

colors = {"graphBackground": "#F5F5F5", "background": "#ffffff", "text": "#000000"}

app.layout = html.Div(
            children=html.Div(["Drag and Drop or ", html.A("Select Files")]),
                "width": "100%",
                "height": "60px",
                "lineHeight": "60px",
                "borderWidth": "1px",
                "borderStyle": "dashed",
                "borderRadius": "5px",
                "textAlign": "center",
                "margin": "10px",
            # Allow multiple files to be uploaded
        # dcc.Graph(id="Mygraph"),
        # html.Div(id="output-data-upload"),

def parse_data(contents, filename):
    global df
    content_type, content_string = contents.split(",")

    decoded = base64.b64decode(content_string)
        if "csv" in filename:
            # Assume that the user uploaded a CSV or TXT file
            df = pd.read_csv(io.StringIO(decoded.decode("utf-8")))
        elif "xls" in filename:
            # Assume that the user uploaded an excel file
            df = pd.read_excel(io.BytesIO(decoded))

    except Exception as e:
        return html.Div(["There was an error processing this file."])

    return df

    Output("column_dropdown", "value"),
    [Input("upload-data", "contents"), Input("upload-data", "filename")],

def column_dropdown(contents, filename):
    if contents:
        contents = contents[0]
        filename = filename[0]
        df = parse_data(contents, filename)
        Dropdown = html.Div([
                options=[{'label': i, 'value': i} for i in df.columns],
                style={'width': '100%', 'height': '60px', 'lineHeight': '60px', 'borderWidth': '1px',
                       'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'display': 'inline-block'},
                placeholder='Select Dataset Column'

        return Dropdown