Use multiple Gradle files

I’m assuming datafile1.gradle and datafile2.gradle are script plugins (i.e. apply from: 'folder1/datafile1.gradle')?

If this is the case then they each use their own classloader. The simplest solution is simply to define a buildscript { } block in each of them.