Activate desactivate canvas with c#

I turn on and off the canvas but I just:

public bool menu = true
public bool otherscene = false;

public void SceneMenu () {
menu = true
otherscene = false;

}

but it will not know how to say it or attach the canvas

If you want to activate a disabled object you can place it in a variable and use the SetActive() function by using something like this:

public GameObject canvasObject; // drag your canvas object to this variable in the editor

// make your canvas active from a disables state by calling this method
public void MakeActive()
{
    canvasObject.SetActive(true);
}

If this is not what you need then please explain more because it was hard to understand what you wanted to achieve.