Changing Rendering Path from script

Hello

I'm trying to write a function that will change the rendering path from Forward to Deffered (and ofc second one to get back to forward)

function RenderingPath_Deffered ()
{
    var go_camera = GameObject.Find("_MainCamera");
    go_camera.camera.renderingPath = RenderingPath.DeferredLighting;
}

So far i got something like this, but it doesn't change the camera setting at all.

Any help would be much appreciated

Another solution (since you already found the issue yourself):

function RenderingPath_Deffered ()
{
    Camera.main.renderingPath = RenderingPath.DeferredLighting;
}

That way just requires your camera has the MainCamera tag, and no special name needed