If you run two separate scripts, they won't share variables between them. Based on the text below, it appears that functions may be what you're actually looking for. You can pass values into them and return values from them. Given the chance, I recommend reading this guide or watching this video to get you started. They'll also describe how to load the API key into an environmental variable, which is a safer method to use than dropping it into a file. It prevents things like accidentally uploading your key to a GitHub repository.
... View more