Groovy interpreter processes import statements inside multiline strings.
For example executing below will result in an error:
def sourceStr="""
import com.xyz
"""
7:03
r-Scheduler-Serial-1 | .c.ConsoleServiceGrpcImpl | Error running script: java.lang.RuntimeException: Attempting to import a path that does not exist: import com.xyz;