GCP cloud function double function call

I created and executed a code similar to this in Cloud Function.

enter image description here

However, in gcp, the list did not contain any values.

Is that the way it is? I would appreciate it if you could let me know if there is a doc address related to it.

enter image description here

Answer

Google’s Cloud Functions takes a function provided in the code as an entry point. I used the test1 function as an entry point and called the test2 function from there.

X = []

def test2 ():

  global X
  X.append(2)

def test1 (self):

  global X
  X.append(1)
  test2()
  print(X)

This will return the value of X in the logs.