Kotlin Dsl Precompiled plugin script with android context

I am trying to declare my android flavors in a separate gradle.kts file and then just apply them in my apps module gradle. But i keep getting Unresolved reference for “android”, “flavors” etc. etc. I tried to use the buildScripts folder for this, still no luck. How should this be done?

Any help is greatly appreciated!
Thank you,