How to use python to rotated cylinder in right position

I’m new to study python programming. I want to create a new model to flip the cylinder automatically. but i don’t how to keep cylinder’ position. Means when rotating the cylinder should have different position.
So i don’t how to define the feature property.
my code as below. thank you advance.
from vcScript import *
comp = getComponent()
app = getApplication()
sim = getSimulation()
sensor = comp.findBehaviour(“ComponentPathSensor”)
servo = comp.findBehaviour(“ServoController”)
path = comp.findBehaviour(“OneWayPath”)

def OnRun():
container = comp.findBehaviour(“ComponentContainer”)
signal = comp.findBehaviour(“ComponentSignal”)

path.Enabled = True
path.CapacityAvailable = True
while sim.IsRunning == True:
for i in range(10000):
triggerCondition(lambda: getTrigger().Value == True)
part = signal.Value
path.Enabled = False
path.CapacityAvailable = False
path.Enabled = True
path.CapacityAvailable = True