How to open/read a script file from another script file

Hi everyone , i am trying to completely program an ur10 form a single script code. But i wanna be able to execute other script form that script . Is there any way to “call” a scipt file in a script code .
This is the script i wanna run , and i wanna call the file “drillprogram” which is another script with a drilling prorgam.i wanna dos this so i can modify the drillprogram without having to modify the main script but the way i am trying to call it , doesn´t work


Does anyboyd know how could i do that?

Thanks in advance

These are the files i crated , the main program which i want it to be able to call the drillprogram

image

Hi @daanielangos,

If you modify the drillprogram.script to start with the line:
def drillprogram:
Then the current content of the file. And in the end insert:
end

And then add it to the Polyscope program tree before the Mainprogram.script, then it should work.

Ebbe

Thanks fro the help!! , is there any way to open the drillprogram without adding it on to the tree , and just adding the drillprogram.script on the programs folder ?

You can write a URCap and add it to the preamble.

Keep in mind that you can have multiple scripts in the same file, so the drillprogram can just be tacked onto the end of the script file for the calling program, meaning you can keep similar scripts together and have fewer script references within the Polyscope tree:

** Start of file drillstuff.script

def drill1():
.
#do stuff
.

drillprogram() #calling drillprogram
.
#do more stuff
.
end

def drillprogram:

.
#drill stuff
.

end

def morestuff():

.
#anything else
.

end

** End of file drillstuff.script