android – Can you replace a childFragment with the help of an activity button?

I want the child to be replaced by pressing the activity button

I have a form in a fragment in which I have a button that opens a camera activity, pressing the button to take the picture, I want the activity to close and replace the childfragment form

The function I want to call since the activity is: is in the fragment

fun setFoto(){
        childFragmentManager.beginTransaction().replace(R.id.fotos, PhotoFragment()).addToBackStack("Capture").commit()
    }

I use kotlin