Jump to content

How to Create a User-Defined Script that Accepts Arguments


---
 Share

Recommended Posts

Hi,

How do I create a user-defined script which can accept arguments? For example, I would like to call scriptA in scriptB. And scriptA basically just printout a simple message which I pass to it.

Example in scriptB:

gom.script.userscript.scriptA('Hello World!')

 

Thank you

mau

Link to comment
Share on other sites

I guess it will not work by the gom.script.userscript-mechanism, which only can run a script. But it should work by the import-mechanism of python itself.

Put everything you need in a function with parameters and call this function from another script after you imported the script.

Example for scriptA:

def showMessage (message):
    print (message)

Example for scriptB:

import scriptA

scriptA.showMessage ("Hello World!")

This also works inside the folder structure inside the GOM Software in the script editor.

Link to comment
Share on other sites

 Share

×
×
  • Create New...