Компонент макета доступа Kotlin за пределами MainActivity

doSomethingFunctionOrClass(activity: AppCompatActivity)
{
    var button = activity.findViewById<Button>(R.id.button)
    // if I try do something with button the app crashes eg
    button.text = "Text"
}
Busy Butterfly