Mantaflow bake fluid from command line, "NameError" : not defined When trying to bake fluid from command line using:

import bpy
bpy.ops.fluid.bake_all()


I receive the following errors:

NameError: name 'fluid_adapt_time_step_2' is not defined
Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
NameError: name 'bake_fluid_data_2' is not defined
Traceback (most recent call last):
  File "&lt;string&gt;", line 1, in &lt;module&gt;
NameError: name 'fluid_save_data_2' is not defined   

...etc...


The names given can be found in:
https://github.com/blender/blender/blob/master/intern/mantaflow/intern/strings/fluid_script.h

I'm guessing baking can't find the settings to bake domain outside of the GUI. Is there code to import such information?



I'm aware of Brecht's answer: Bake Fluid Simulation via CLI or Python?, 
which didn't work.

Moreover, recent Brecht's interaction concerning Mantaflow baking: https://devtalk.blender.org/t/feature-request-mantaflow-bake-command/11105

Update from https://github.com/ichlubna/blenderScripts/issues/1 : probably is a bug: https://developer.blender.org/T75889

terminate called after throwing an instance of 'Manta::Error'
  what():  can't clean grid cache, some grids are still in use
Error raised in /home/sources/buildbot-x86_64-slave/linux_glibc217_x86_64_cmake/blender.git/extern/mantaflow/preprocessed/fluidsolver.cpp:33
Baking Mantaflow (fluid) from command line works now. However, thus far, only with Blender 2.83+.

https://developer.blender.org/rBa50c131a0d71d04915cc39c5a412f4f16c6f706b :

"The issue was the usage of the global __ main __ Python module.
When running scripts in the text editor, Blender would overwrite
the __ main __ module."



Thanks to Ichlubna! ..and the many kind devs.