The loaded file can contain statements at top level or just load and run a closure. For example:
def pipeline node('slave') { pipeline = load 'pipeline.groovy' pipeline.functionA() } pipeline.functionB()
Where pipeline.groovy
defines functionA and functionB functions (among others) before ending with return this;