module mode problem

Why wont this work with module mode?


Here are some pictures of what i am trying to do.


Well done providing screenshots. However, without an error console, we’d be guessing. I recommend you look at the Python console window and see what it tells you - the error messages are designed to be useful :wink:

There is no error.

try a Return at the bottom of add_lungs or shorten the name of the first one, else no idea.

The main function you have there is attached to a ray sensor. It will only trigger when the ray sensor is positive. If you want it to check the distance every tic you’ll need an always sensor too.
You can do a ray in python as well, so you wouldn’t need two sensors then.

I forgot to put the positive pulse on the always sensor.

This happens when the code acts as sensor as well. You need to constantly check if the condition is met (or not).