winIDEA SDK
test_find_existing_instance.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8def test_findExistingInstance():
9 print("Finding existing instance by ID...")
10 cfg = ic.CConnectionConfig()
11 cfg.instanceId("sdk_example")
12 connMgr = ic.ConnectionMgr()
13 port = connMgr.connect(cfg.start_existing())
14 if port > 0:
15 print(f"Instance found, port: {port}")
16 else:
17 print(f"Instance with ID 'findExistingInstanceExample' not found")
18
19 # alternatively, user can find instance by specifying workspace file path
20 # cfg.workspace("C:/Desktop/myWorkspace/Sample.xjrf")
21
22
23if __name__ == "__main__":
24 test_findExistingInstance()