how can I reference a list of modules, from inside...
# koin
j
how can I reference a list of modules, from inside another module? inside my application
onCreate
, I've got the following:
Copy code
startKoin {
    androidContext(this@MyApplication)
    modules(listOf(
        newsModule
    ))
}
and then my
newsModule
looks like this:
Copy code
val newsModule = module {
    listOf(
        networkModule,
        uiModule
    )
}
unfortunately, this doesn't work.. it builds, but everything provided inside
networkModule
and
uiModule
isn't accessible. how can I achieve this?
v
What’s the use case for doing this? If you define a dependency in a modules block, that dependency should be accessible everywhere
j
okay yeah I can explain. I'm working with an Android application which has an
app
Android-module, and multiple other Android-modules. one of those other Android-modules is called
news
. so what I would like to do is simply have the
app
call
startKoin
on the primary
newsModule
, and then
newsModule
might have a list of other modules inside of it, which
app
doesn't need to refer to
p
Try:
Copy code
startKoin {
    androidContext(this@MyApplication)
    modules(newsModule)
}

val newsModule = listOf(
    networkModule,
    uiModule
)