I am trying to run a Python application on Google Cloud Run on GCP and the code includes an
if __name__ == '__main__':
statement. For some reason, the code after this statement does not run and
print(__name__ == '__main__')
returns 'False'
while
print(__name__)
returns 'main'
.
When I run the code in a Jupyter notebook,
print(__name__ == '__main__')
returns 'True'
while
print(__name__)
returns '__main__'
.
Why does (i) print(__name__ == '__main__')
return 'False'
and (ii) print(__name__)
return 'main'
when the code is run on Google Cloud Run? And how does one fix this issue?