I have written a neat Python module that contains some custom SPSS functions for my coworkers to use. However, to use the functionality, they first need to type BEGIN PROGRAM. Import module etc... before actually calling the function. Because most of them aren't tech savvy, I'm looking to make things easier.
Now they have to type something like this:
BEGIN PROGRAM.
import sys
sys.path.append("C:/Python scripts")
import mymodule
mymodule.custom_function('a','c')
END PROGRAM.
Is there a way I can write some SPSS-macro that will call the functions from my Python module in a single line? Like this:
!mymodule.custom_function varlist=a,b
I've tried defining a normal SPSS-macro and writing the BEGIN PROGRAM etc. in the macro body, but this yields an error. It seems that a macro-body can only contain valid SPSS syntax and no python code.
Is there another solution?