Using .FindChild(x) where x is a variable

I need to find a way where you can access variables from a script on a Game Object, when the Game Object is not defined. I know I may not be explaining this well so here’s an example of the code I tried that I know is wrong, but it kinda shows what I’m trying to do:

var x = "hello";

var y = "";

update () {

y = transform.findChild(x).getComponent(myScript).myVar

}

y = transform.Find(x).GetComponent(myScript).myVar;

There are lots of ways that this code can fail - so you might want to check it bit by bit, meaning, can you find a child with the name x. Does that child have a script called myScript.