in reply to if condition within module
You are asking how to use if()in a module.
- Your code doesn't show a module
- The use of if()isn't any different in a module than a main script.
So I'm not sure how to answer your question.
Is it possible you are really asking how to write a module?