How to fix the "A GXpy instance has already been created for current thread" in Oasis Montaj

Hey everyone!

I am currently running Oasis Montaj 2025.2.1, and trying to run any python script (including the in built "Hello World" script"), using python 3.12 with Geosoft 2.0 package.

When I run any code, I get the following error, no matter what I run (even if I restart the program):

image.png image.png

Any idea of potential fixes for this issue?

Many thanks,

Tim

Answers

  • SerbanMarin1
    SerbanMarin1 Posts: 6 Staff

    Hi @EGSMontaj1 this error usually means that you are creating a context (calling "gxpy.gx.GXpy()") multiple times in the same script execution. This may also happen if you call a script with this line from another script that has already created a context. We may be able to help more if you share the code.