assigning animation controller in script

Hello, I am trying to assign an animation controller through script. However, I cant get this to work. I am trying with two different ways and neither are working.

playerAnimation.runtimeAnimatorController = Resources.Load("animController") as RuntimeAnimatorController;
        playerAnimation.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("animController");

My file structure is the main asset folder, then a resource folder in there and then the animation in that resource folder. Should this work? I need to do this through script and not in the inspector as i need to change the controller at one point

Break it apart, see if you are able to load it and assign it to a temporary variable first, and make sure it’s not null.

Once that works, then move onto assigning it. Otherwise you have no idea where it is failing.