Settings gradle custom plugin problem

I created my plugins for a Plugin project.
With them connected, there are no problems in build.gradle.kts, they work fine. By making another plugin for setttings.gradle.kts of type Plugin and including it in setttings.gradle.kts. I’m starting to have problems with the plugin for projects
Type com.android.build.api.dsl.ApplicationExtension not present
What needs to be done to make this work?

It’s totally unclear (to me) what you try to do, and what error you get.
Can you maybe create an MCVE to clarify what you are trying and what problem you have?

I have this plugin for build.gradle.kts (app), connect it to the block `plugins. It works great.

internal class AndroidApplicationConventionPlugin : Plugin<Project> {
    override fun apply(target: Project) = target.run {

        with(pluginManager) {
            apply("com.android.application")
            apply("org.jetbrains.kotlin.android")
        }

        extensions.configure<ApplicationExtension> {
            configureKotlinAndroid(this)
            defaultConfig.targetSdk = 33
        }
    }
}

Created a plugin for setting.gradle.kts (project), connect it to the block plugins. I get an error Caused by: java.lang.TypeNotPresentException: Type com.android.build.api.dsl.ApplicationExtension not present for this AndroidApplicationConventionPlugin

class Test : Plugin<Settings> {
    override fun apply(target: Settings) = target.run {

    }
}

All my plugins are in buildSrc/convention-plugin-module and registered in build.gradle.kts(convention-plugin-module). Why am I suddenly getting this error?

@Vampire, I created my plugin AndroidApplicationConventionPluginof this type Plugin<Project>
Plugged it in build.gradle.kts (app). It works great.

internal class AndroidApplicationConventionPlugin : Plugin<Project> {
    override fun apply(target: Project) = target.run {

        with(pluginManager) {
            apply("com.android.application")
            apply("org.jetbrains.kotlin.android")
        }

        extensions.configure<ApplicationExtension> {
            configureKotlinAndroid(this)
            defaultConfig.targetSdk = 33
        }
    }
}

Then I made a plugin SettingsConventionPlugin for settings.gradle.kts (project). Connected here in the block plugins

class SettingsConventionPlugin : Plugin<Settings> {
    override fun apply(target: Settings) = target.run {

    }
}

And I get an error for AndroidApplicationConventionPlugin

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'subholder.android.application'.
	at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:173)
	at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:137)
	at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyPlugin$1(DefaultPluginRequestApplicator.java:148)
	at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:199)
	... 189 more
Caused by: java.lang.TypeNotPresentException: Type com.android.build.api.dsl.ApplicationExtension not present
	at org.gradle.api.reflect.TypeOf.captureTypeArgument(TypeOf.java:299)
	at org.gradle.api.reflect.TypeOf.<init>(TypeOf.java:96)
	at AndroidApplicationConventionPlugin$apply$lambda$1$$inlined$configure$1.<init>(TypeOfExtensions.kt:28)
	at AndroidApplicationConventionPlugin.apply(AndroidApplicationConventionPlugin.kt:28)

All my plugins are in buildSrc/convention-plugin-module and registered in build.gradle.kts(convention-plugin-module).
What did i do wrong?

I created a working plugin AndroidApplicationConventionPlugin like Plugin<Project> for build.gradle.kts (app). It works without problems.

internal class AndroidApplicationConventionPlugin : Plugin<Project> {
    override fun apply(target: Project) = target.run {

        with(pluginManager) {
            apply("com.android.application")
            apply("org.jetbrains.kotlin.android")
        }

        extensions.configure<ApplicationExtension> {
            configureKotlinAndroid(this)
            defaultConfig.targetSdk = 33
        }
    }
}

Then i created a plugin SettingsConventionPlugin for settings.gradle.kts (project). Connect it to the block plugins in the settings.gradle.kts file.

internal class SettingsConventionPlugin : Plugin<Settings> {
    override fun apply(target: Settings) = target.run {

    }
}

And then i get an error for AndroidApplicationConventionPlugin

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'subholder.android.application'.
	at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:173)
	at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:137)
	at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyPlugin$1(DefaultPluginRequestApplicator.java:148)
	at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:199)
	... 189 more
Caused by: java.lang.TypeNotPresentException: Type com.android.build.api.dsl.ApplicationExtension not present
	at org.gradle.api.reflect.TypeOf.captureTypeArgument(TypeOf.java:299)
	at org.gradle.api.reflect.TypeOf.<init>(TypeOf.java:96)
	at AndroidApplicationConventionPlugin$apply$lambda$1$$inlined$configure$1.<init>(TypeOfExtensions.kt:28)
	at AndroidApplicationConventionPlugin.apply(AndroidApplicationConventionPlugin.kt:28)

What am I doing wrong?

Let me ask again, can you maybe create an MCVE? What you provided neither fulfills the C(omplete) nor V(erifiable).