For example, suppose I have a file with the contents:
int a = 1;
int b = 2;
Can I load those variables directly into my script
No, at least not like that.
Remember that C/C++ is a compiled language. Each code line in your sketch is translated into low-level machine code before the sketch is uploaded to the "Arduino" (in this case an Arduino-compatible ESP32 board). The Arduino has no C compiler of its own, it relies on the PC to do that before the upload. So you can't put lines of C code into a file, to be read by the Arduino and compiled, it can't do that.
But what you could do is put into your file:
and then your sketch can open that file and read the first line into variable a and the second line into variable b.