Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

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 »

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 »

Of course it is possible.
Look at the example:
Script-Function.jpg
Script-Function.jpg (13.12 KiB) Viewed 2492 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 »

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