```fun Fragment.createFragmentScope(): Scope { ...
# koin-contributors
p
Copy code
fun Fragment.createFragmentScope(): Scope {
    if (this !is AndroidScopeComponent) {
        error("Fragment should implement AndroidScopeComponent")
    }
//    if (this.scope != null) {
//        error("Fragment Scope is already created")
//    }
    val scope = getKoin().getScopeOrNull(getScopeId()) ?: createScopeForCurrentLifecycle(this)
    val activityScope = requireActivity().getScopeOrNull()
    if (activityScope != null) {
        scope.linkTo(activityScope)
    } else {
        scope.logger.debug("Fragment '$this' can't be linked to parent activity scope")
    }
    return scope
}
I think the root cause is the usage of
requireActivity()
inside
createFragmentScope()
.