Calling task of another gradle file in build.gradle file

Hi, I created a custom gradle file “extractYaml.gradle” with task “extract”. I want to call this task in build.gradle. Here is the code I wrote in build.gradle:

task externalCall(type: GradleBuild) {
buildFile = ‘path/extractYaml.gradle’
tasks = [‘extract’]
}

task extractYaml() {
mustRunAfter externalCall


}

This failed with following reason: Task ‘extract’ not found in project ‘:gradle’.

I just simply want to call the task from exteranl gradle file in build.gradle.

I am very new to gradle stuff. This one probably very basic question but please help me to find out the solution. Appreciate it.