The code I posted should work if the cylinder is oriented along its local z-axis. If the cylinder is oriented upward along its local y-axis, then you would need to perform another pre-rotation after the lookat.
Code:
object.translate(P1)
object.lookat(P2)
object.rotate(0,90,0,'',viz.RELATIVE_LOCAL)