maybe separating the python script will help?