Get_GameObject non fatal error reoccuring

I have many scripts that use the ‘get_GameObject’ function, and errors like these keep appearing.

ArgumentException: get_gameObject can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
playerhealth…ctor () (at Assets/scripts/playerhealth.js:2)

get_gameObject can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.

UnityException: You are not allowed to call this function when declaring a variable.
Move it to the line after without a variable declaration.
If you are using C# don’t use this function in the constructor or field initializers, Instead move initialization to the Awake or Start function.
playerhealth…ctor () (at Assets/scripts/playerhealth.js:2)

They don’t Obstruct gameplay as far as I have noticed, but they do keep coming up in the console and it’s becoming frusterating. Is there a different function i can use, or any way to remediate the errors?

Check this: ArgumentException: get_value can only be called from the main thread - Unity Answers