Using AutoHotkey.dll would allow you to load the script into the same process as the Python (or whatever) interpreter, and (presumably) call whatever function at will, so that seems like a good solution.
Otherwise, it is
not necessary to compile the scripts. All you need to run a script is a copy of AutoHotkey.exe. If run it from the command line or from another script, there's no need to install it. A compiled script is essentially just a copy of AutoHotkey.exe combined with your script.
Whether or not you compile, you don't need to split the functions out into separate files. You can use command line args to choose which function call. For example,
%1%() would call the function named by the first command line arg. (To pass the other args to the function, you would need to pass them indirectly, such as by copying them into non-numeric variables:
arg = %2%.)
If you do find a need for separate scripts with shared functions, you can put the shared functions in a separate (third) file and #include it in both scripts. Ahk2Exe merges each #include into the script when it compiles the script (if you compile).
There would be a performance loss if you run AutoHotkey.exe each time you need to "call" a function, as it would need to start a new process and parse the script text each time. You could avoid this by running a persistent script and using some form of inter-process communication, such as
ObjRegisterActive (and from the Python side,
win32com.client.Dispatch()). However, you'd need to use something else for AppleScript or whatever.
@joedf: What is the purpose of having a frontend and a backend if the two are inseparable? Ulysses already described how two different backends would be used; one on Windows, one on Mac.
Using AutoHotkey.dll would allow you to load the script into the same process as the Python (or whatever) interpreter, and (presumably) call whatever function at will, so that seems like a good solution.
Otherwise, it is [b]not[/b] necessary to compile the scripts. All you need to run a script is a copy of AutoHotkey.exe. If run it from the command line or from another script, there's no need to install it. A compiled script is essentially just a copy of AutoHotkey.exe combined with your script.
Whether or not you compile, you don't need to split the functions out into separate files. You can use command line args to choose which function call. For example, [c]%1%()[/c] would call the function named by the first command line arg. (To pass the other args to the function, you would need to pass them indirectly, such as by copying them into non-numeric variables: [c]arg = %2%[/c].)
If you do find a need for separate scripts with shared functions, you can put the shared functions in a separate (third) file and #include it in both scripts. Ahk2Exe merges each #include into the script when it compiles the script (if you compile).
There would be a performance loss if you run AutoHotkey.exe each time you need to "call" a function, as it would need to start a new process and parse the script text each time. You could avoid this by running a persistent script and using some form of inter-process communication, such as [url=http://ahkscript.org/boards/viewtopic.php?f=6&t=6148]ObjRegisterActive[/url] (and from the Python side, [c]win32com.client.Dispatch()[/c]). However, you'd need to use something else for AppleScript or whatever.
@joedf: What is the purpose of having a frontend and a backend if the two are inseparable? Ulysses already described how two different backends would be used; one on Windows, one on Mac.