Python Logic Bricks

How do you create logic bricks with Python, or create action channels with Python? :confused:

I always wanted to figure that out…