In case anybody encounters a similar problem , it was created by some print statements
i had placed for debuging , which crashed the app when it was ran outside the IDE. After
removing the print statements , both cases work fine.
Also, I don't understand why print statement would crash your app.
Instead of using print statement for debugging I would suggest that you consider using Python's logging module. I just recently started using it and I really like it, one can put debugging in until it comes out your ears and if you don't want it you just set a value in e.g. a logging configuration file and/or some startup option or ....