在函数中调用自定义PHP

TLDR: I want to use get_theme_mod() inside a PHP file other than functions.php in WordPress to use a value added through customizer.

Long version:

I am making an API call using cURL in a separate PHP file. I want to create a new panel in customizer with an inputfield that accepts the API-key for my custom PHP API call. Basically I need to know if I can use the get_theme_mod() method to call the value into my custom PHP file, store it in a variable and use it to append it to my API call.

This is my API call code

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://maps.googleapis.com/maps/api/place/details/json?placeid=< GOOGLE PLACE ID >&key=< MY API KEY>",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Cache-Control: no-cache",
    "Content-Type: application/json"

  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Once the call is made, I AJAX this file into a JavaScript file where I work with the data. Which is initially why I put the API call into a separate file. My goal is for the person working on the site to simply paste an API key, or the place id for Google and have the entire process execute without having to monkey around in the source code. I have all the infrastructure in place and the call works I just wanted to eliminate the need for us to touch the source code and simply drop an API key value in the customizer and let the code do the rest.

I'm assuming you mean the theme customizer? Maybe instead save settings using the Settings API. But you should also do AJAX the "wordpress way" or use the newer REST stuff.

Directly answering your question of "how to use Wordpress functions in external PHP" see https://wordpress.stackexchange.com/questions/47049/what-is-the-correct-way-to-use-wordpress-functions-outside-wordpress-files

<?php 
define('WP_USE_THEMES', false); // although you might want that to be true if you're using theme data?
require('./wp-load.php');
?>

Or maybe consider doing all that stuff in a shortcode that takes the place key and/or api key, e.g. [get-place-info placekey="xxxxx" apiKey="xxxx"] so your user can dump it anywhere, unless you specifically need it available to javascript (heck, you could have the shortcode dump JSON into the page).