Python Script of DropdownList PropertyChange

I have a requirement in my development , which needs to write a script when I selected an item. How could I write the python script? Now I used the below if condition:
if event.propetyName == ‘componentRunning’:
event.source.SelectedIndex = 0
if event.propetyName == ‘selectedValue’:
myScript
but, it’s running when I didn’t selected an item.In other words,the script will be executed many times.
What I need is that my script will execute a time not many times when I selected an item.

This shouldn’t fire twice unless your script is also setting the value, causing a loop. Do you have any bindings on the selectedIndex, selectedValue, or selectedStringValue, or selectedLabel?

Also consider removing your if event.propertyName == 'componentRunning' initialization script and just setting the noSelection properties to your desired default (0)