Send variables to python script and extract the output from it

I am trying to build a system where there is a loop, which is looping for all the files in the folder, and the path of the file is stored in a variable, i want to give the variable value to the bat file, which later runs the python script and extract data from the file. and i also want the extracted data to be given back to the rpa for further processing.
So how can it be done?

You can use a text file to pass the inputs and another text file to store the output. If you have multiple values to pass and retrieve, try using a JSON file.