Methods with more than one arg don't work when I 'apply from:' external script

I have a decent amount of code that I currently copy/paste into all of my projects’ build scripts, so I’m trying to make a re-usable gradle script I can use via apply from:.

The single-arg methods work fine from the external script, but gradle isn’t recognizing the methods with more than one arg.

I get Could not find method optionalMod() for arguments [true, com.terraformersmc:modmenu:3.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

This is the call that causes the error: build.gradle · use-mod_gradle_scripts · Will / automated_crafting · GitLab

and this is the method I want it to use: depHelper.gradle · experimentation · Will / mod_gradle_scripts · GitLab

I’ve tried messing with the method signature by removing the explicit types, trying a few different types, and changing the order of the args. Nothing I’ve tried has made a difference.