alternatively check the sim is enabled beforehand and turn it on if not yet enabled
devs = proj.find('testdev')
if len(devs) > 0:
# check if sim is enabled
cur_sim_mode = devs[0].get_simulation_mode()
print(cur_sim_mode)
# enable sim conditionally
if not cur_sim_mode:
devs[0].set_simulation_mode(True)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
alternatively check the sim is enabled beforehand and turn it on if not yet enabled