#2142 How to call a fan script from another?

SlimerDude Fri 17 May 2013

I suspect the answer to this is either going to be very simple, or very complicated...

If I have fan script, how do I created an instance of a class that lives inside another fan script? (I'm talking scripts here, not classes in pods.)

Specifically, I have myScript.fan and I want it to create an instance of build.fan so it can read / access the podName the pod name field.

brian Fri 17 May 2013

Core API:

Env.cur.compileScript(file).make->main

If you are in a build script, then you can use FanScript which just wraps that code:

FanScript(this, file).run

SlimerDude Fri 17 May 2013

Awesome, it was the simple case! Env.cur.compileScript(file).make does the job.

Login or Signup to reply.