how to get parent script from sourced script?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get parent script from sourced script?

Michael Pitoniak

Greetings,

 

 Is it possible to get the parent script name from a script that has been  sourced by the parent similar to getSourceFileInfo()?

 

i.e:.

 

parent_script{

 

            source(child_script){

 

                        print(“The script that sourced me is:  “ + getparentScriptName();   <- how??

 

            }

 

 

}

 

 

Thx,

 

mp

Reply | Threaded
Open this post in threaded view
|

Re: how to get parent script from sourced script?

Walter Mundt
Michael Pitoniak wrote:
>  Is it possible to get the parent script name from a script that has
> been  sourced by the parent similar to getSourceFileInfo()?

You could try this.  I've only tested a this very simple case on bsh 2.0b4.

a.bsh:
source("b.bsh");

b.bsh:
print(this.interpreter.parent.getSourceFileInfo());


Walter.Mundt.vcf (308 bytes) Download Attachment