Option to reload project modules during a set of commands

Hi !

I have a task that generates a set of modules that are automatically included in the project. Currently, I have to restart gradle so it adds those modules to the project: gradlew generate && gradlew build

Is there a way to ask gradle to reload the current project ?