:wave: Just started learning Kodein. If I have 2 m...
# kodein
s
đź‘‹ Just started learning Kodein. If I have 2 modules and
module B
needs to use an instance from
module A
is the best practice to import
module A
into
module B
? For example,
subscribersModule
needs the retrofit instance from `networkingModule`:
Copy code
val networkingModule = Kodein.Module("networking") {
    bind<Retrofit>() with singleton {
        Retrofit.Builder()
            .baseUrl("<https://api.example.com/>")
            .build()
    }
}
Copy code
val subscribersModule = Kodein.Module("subscribersModule") {

    import(networkingModule)

    bind<SubscribersService>() with singleton {
        instance<Retrofit>().create(SubscribersService::class.java)
    }
}
r
If you use your modules in a global container you don’t need to do this. instead, you can import them inside the global container like
Copy code
val applicationContainer = Kodein {
    import(subscribersModule)
    import(networkingModule)
    // ...
}
s
Haha yeah it is. Thanks for the answer!