object child of current object in script

krogle.transform.parent = GameObject.Find(“premec2”).transform;

This way I make a Gameobject krogle a child of GameObject, why does this not work:
krogle.transform.parent = transform;

Or how do I make some GameObject a child of the current GameObject in script.

Did you look at This

You must use:
krogle.transform.SetParent(newParent);
Where, new parent is a transform.
Check it out the link that kskjadav007 shared.