Create Gurobi environment in module

I am working on a project in a module which I reference from a Jupyter notebook. As discussed here, I tried initialising the Gurobi environment with const GRB_ENV = Gurobi.Env(). It seems to initialise successfully as the module is loaded (I added print statements to confirm this), but once the module is loaded, the GRB_ENV module contains a null pointer. Could someone please explain what is happening? Do I have to initialise this at the global scope and pass it in?

Maybe try initializing it in __init__()? (docs)

1 Like