Passing enviroment variables outside JupyterLab to another Python script

Hello Community,

I am working on a problem to get some variable out of the JupyterLab to a python script.

I have the following lines that store the environment variable within my notebook.

import os
os.environ['X'] = score
os.environ['Y'] = file

When I execute my notebook for the variable to be printed, it shows in the output.
As a note, these values get updated every time I execute my notebook so I want to send the recent value to the python script.

The python script is a service that uses methods like GET and POST. And when it executes, it opens up an HTML page with the parameters. At the moment, it is hard-coded in the python script. I am not sure where to set this in the jupyter_config.py file or somewhere else to pass the parameters into this python script. I use this in a GitLab environment.