The issue was that the current implementation heavily depends on dumping
variables into the __main__ module...
However, sometimes Blender replaces that module when a script in the
text editor is executed. In that case the mantaflow script did not have
access to the variables it needed.
A better fix would be to create a separate module that contains all the variables.
Unfortunately, mantaflow dumps some variables into this module itself using PyRun_SimpleString.
Changing that, might require changes in the mantaflow API. That's out of scope for this fix.
This fix just makes sure that mantaflow always uses the same module independent of whether
it is invoked from some button press or a script from the text editor.