Python – Calling function defined in exe


I need to know a way to call a function defined in the exe from a python script.
I know how to call entire exe from py file.

Best Solution

Unless your EXE is a COM object, or specifically exports certain functions like a dll does, then this is not possible.

For the COM method take a look at these resources:

For the exported functions like a dll method, please use python's win32 module along with the Win32 API LoadLibrary and related functions.

If you have access to the EXE's source code:

If you have access to the source code of this EXE though, you should define command line arguments and tie that into calling the function you want to call. In this case you can use the python os.system call to start your application or