NameError: name 'g_o' is not defined.
Should I remove it ?
I am not at all familiar with Python.
I guess you did not add the proper boiler plate code to make the connection between PLAXIS and Python. see here for more details: https://communities.bentley.com/products/geotech-analysis/w/wiki/46005/using-plaxis-remote-scripting-with-the-python-wrapper
you mentioned not being too familiar with Python. I suggest to watch this training:
https://www.youtube.com/playlist?list=PLi6GGAwNWJlC_szRmgfkjrjlqjEqDmEc0