komponen tata letak akses Kotlin di luar 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