Using a community plugin within a custom gradle plugin

I’m building a plugin in kotlin that will be published to a Maven Repo. Is there a way that I can use a community plugin and configure it within my new plugin? To configure the community plugin within a build.gradle file I would do this:

 openApiGenerate {
      // Config code here

I would like to be able to do this with my plugin task.

Currently, I have classes that implement Plugin and DefaultTask().


abstract class MyPluginTask : DefaultTask() {
    fun myPluginTask() {
         // Would like to put code here to configure the community plugin


open class MyPlugin : Plugin<Project> {
    override fun apply(project: Project) {
        val myTask = project.tasks.register("myTask", {
			this.description = "This is the main task for this plugin" = BasePlugin.BUILD_GROUP