# Multiple Modules

In apps that want to share DBFlow across multiple modules or when developing a library module that uses DBFlow, we have to provide a little extra configuration to properly ensure that all database classes are accounted for.

It's directly related to the fact that annotation processors are isolated between projects and are not shared.

In order to add support for multiple modules, in each and every library/subproject that uses a DBFlow instance, you must add an annotation processing argument to its `build.gradle`:

Using KAPT:

```java
kapt {
    arguments {
        arg("targetModuleName", "SomeUniqueModuleName")
    }
}
```

or if you use Android/Java:

```java
// inside android -> defaultConfig
javaCompileOptions {
      annotationProcessorOptions {
        arguments = ['library': 'true']
      }
    }
```

By passing the targetModuleName, we append that to the `GeneratedDatabaseHolder` class name to create the `{targetModuleName}GeneratedDatabaseHolder` module.&#x20;

**Note**: Specifying this in code means you need to specify the module when initializing DBFlow:

From previous sample code, we recommend initializing the specific module inside your library, to prevent developer error. **Note**: Multiple calls to `FlowManager` will not adversely affect DBFlow. If DBFlow is already initialized, we append the module to DBFlow if and only if it does not already exist.

```kotlin
fun initialize(context: Context) {
  FlowManager.init(context) {
    databaseHolder<SomeUniqueModuleNameGeneratedDatabaseHolder>()
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dbflow.gitbook.io/dbflow/develop/usage2/advanced-usage/multiplemodules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
