Hand over variables declared in main() to on_frame_ready()

For a project, I used the BodyViewer as a base. I have some variables, that I have to declare in main() (it´s because of a library I built with MatLab compiler). I need to use the variables in the on_frame_ready() function, which is called when astra_update() has a new frame. Because I can´t declare the variables globally and the function isn´t called like a typical function I haven´t found a possibility to hand over the variables to the function.
Is there any built-in way to do this?