pythoncomcanoe

CANoe multiple instances using win32com


I'm trying to create two CANoe instances using Python (win32com module).

I'm trying to create two objects and open the configurations, but it creates only one instance. How can I achieve creating two CANoe instances?

I disabled the option in the application which was to permit only one instance (I am able to open two CANoe instances manually).

application = win32com.client.DispatchEx("CANoe.Application")

application.Open(config)

application2 = win32com.client.DispatchEx("CANoe.Application")

application2.Open(config2)

Solution

  • It is possible to do this but not recommended.

    You can navigate to the CAN.ini file and change the following under [System] tag. (Default value is 0)

    SingleCOMClient=1
    

    A warning is mentioned just about this line. So, use this option with CAUTION!
    Restart CANoe once to bring this change to effect.
    The .ini file can be found in C:\ProgramData\Vector\CANoe\<version>\CAN.ini

    NOTE : Using DispatchEx will create a new instance by default.
    Using Dispatch will first check if any existing CANoe instance is available and attach to that instance. If no open instance, then it will create a new one.