How can the Boolean Switch change the value of a variable in Python?

import dash
import dash_daq as daq
import dash_html_components as html

external_stylesheets = [‘https://codepen.io/chriddyp/pen/bWLwgP.css’]

Abool = False
app = dash.Dash(name, external_stylesheets=external_stylesheets)

app.layout = html.Div([
daq.BooleanSwitch(
id=‘my-boolean-switch’,
on=False
),
html.Div(id=‘boolean-switch-output’)
])

@app.callback(
dash.dependencies.Output(‘boolean-switch-output’, ‘children’),
[dash.dependencies.Input(‘my-boolean-switch’, ‘on’)])
def update_output(on):
global Abool
Abool= ~Abool
print(Abool)
return ‘The switch is {}.’.format(on)

if name == ‘main’:
app.run_server(debug=True)

I want variables like Abool to change outside the app.
Is this okay with this use?