How to synchronize Python with my MFC program.(I using Pywin32 Lib)

  dispatch, mfc, operating-system, python, system

Python and the C++ project are using the COM function.

When I was execute Dispatch Function in Python (ex: win32com.client.Dispath), the program enter the Initinstance Function of MFC.

Expect motion : Execution of ‘LoadTestSetup’function after ‘Dispatch’function is completed
Problem : while execution ‘Dispatch’Func, ‘LoadTestSetup’Func is executed

  • refer : ‘LoadTestSetup'(COM function) and Dispatch(Initinstance function) is the same thread.

The below is Python Code :

from win32api
import win32com.client
Tool = win32com.client.Dispatch("Tool Registry Number")

Source: Python Questions