Use `self` parameter to retrieve the actual 'owner' Main. Previous code was using G_MAIN, which _should_ be fine in current usage context, but would for sure break if these functions were to be used from e.g. a temp Main. Pull Request: https://projects.blender.org/blender/blender/pulls/134440