defining functions I can call from python scripts

Do you have questions about writing plugins or scripts in Python? Meet the coders here.
Post Reply
miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

defining functions I can call from python scripts

Post by miljbee » Tue Oct 12, 2010 9:50 am

Hello,

Is there a way to define "functions" or "sub" or something similar, that I could call from python scripts (actions) ?

Regards,
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

User avatar
Pako
Plugin Developer
Posts: 2294
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: defining functions I can call from python scripts

Post by Pako » Tue Oct 12, 2010 12:01 pm

Of course it is possible.
Look at the example:
Script-Function.jpg
Script-Function.jpg (13.12 KiB) Viewed 2722 times
Python script contains this code:

Code: Select all

def TestFunction(txt):
    print txt
eg.globals.testFunction = TestFunction
Pako

miljbee
Experienced User
Posts: 146
Joined: Fri Mar 27, 2009 1:29 pm
Location: Orléans, France

Re: defining functions I can call from python scripts

Post by miljbee » Tue Oct 12, 2010 4:59 pm

great !

Thank you very much !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.

Post Reply