At Google Cloud (And Google also), "all is API". Thus, if you need to access from a product to another one, you need to do this through API calls.
If your Cloud Functions needs to invoke a script hosted on a Compute Engine VM instance, you need to expose an API on this Compute Engine instance. A simple flask server is enough, and expose it only on the private IP is also enough. But you can't directly access from your Cloud Functions code to the Compute Engine instance code.
You can also deploy a Cloud Functions (or a Cloud Run if you need more system packages/libraries) with the model loaded in it, and like this perform all the computation on the same product.
I have created an instance on GCP to run some machine learning model for an app I am working on for a little project. I want to be able to call one of the methods in one of the files from my app and I thought a Cloud Function would be suitable.
To make this question simpler, let's just imagine I have a file in my instance called hello.py and a method in this file called foo(sentence). And foo(sentence) simply returns the sentence parameter.
So how do I call this method foo in python.py and capture the output?
Thanks
How to call function in GCP Instance from Cloud Function