I would like to build something into my Python module that can throw a warning if the user has not done something correctly. For example if the user has a while loop with nothing in it that will block threads, or a user does not initialize something correctly.
Currently I am loading the python file before it runs with a "pre-runtime" script to check these warnings. However it still requires the user to run this pre-check script. I would like to figure out how to do this in my main module. Aside from loading the python script as a string and then parsing it I can't think of a good way to do this.
For example if the user runs this code
import myModule
test = myModule.module()
print("Hello")
while 1:
True
They would get
>> Warning, you used a print statement, they have no power here.
Or the alternative example in the other direction
import myModule
test = myModule.module()
They would get
>> Warning there is no while True loop, your code will just exit