If the code from the other thread does not solve your issue, you might want to use a light map to achieve the intended result. The following official example demonstrates how this could look like:
Creating a light map is not that easy since you need a tool like Blender to bake the lighting of a scene into a texture. However, there are tutorials online that explain the steps of this process.