Reputation: 913
I have a COM dll which is created using ATL COM with C++. I am creating an Python application which can reuse the existing business logic written in COM C++.
I am looking for a way to consume the COM class object methods from the COM DLL from python. Please suggest ways to achieve this.
Upvotes: 0
Views: 42
Reputation: 49
Assuming that your COM Object supports IDispatch, the simplest way to achieve this is by using pywin32. Here is a sample code, please replace the "PyCOM.Sample.1" with the ProgID of your COM Object. It goes without saying that you will need to make sure that pywin32 is installed before trying the code.
from win32com.client import Dispatch
com_object = Dispatch("PyCOM.Sample.1")
result = com_object.HiPython()
print(result)
Upvotes: 1