In my scripts I used to connect to AutoCAD via Python win32com
library:
app = win32com.client.Dispatch("AutoCAD.Application")
aDoc = app.ActiveDocument
mSp = aDoc.ModelSpace
It mostly works well, but sometimes when the AutoCAD is properly opened and Model Space is active this code can't find launched AutoCAD in the system, and launches new copy of AutoCAD instead. The same may happen when I try to get MS Word documents in this way. Is there any explanation for such an odd behavior and is it possible to fix it?