Battery bench is a background *plugin*, not just a background thread; the plugin itself has to be able to run in the background. The plugin in this case is Lua, not your Lua program, and the Lua plugin isn't a background plugin yet. You would need to modify the Lua plugin code to make it able to go into the background.