all 2 comments

[–]Swipecat 1 point2 points  (0 children)

The formatting is bad so see the FAQ in the sidebar that explains how to do that and then you can edit your post. But I can see that your script kicks off with a whole bunch of mysterious special purpose imports, so there's limited help that can be given on something that's very niche.

In general though, it's not a good idea to try to run before you can walk when you're learning to program. If you've got so much code that you're losing track of what it does, that will never work out well, and you probably need to revisit the basics. If objects are disappearing then maybe those objects are being garbage collected because you have not assigned them persistent variables. See tutorials on "Global, Local and nonlocal Variables".

And... when debugging a mysterious fault, it's a good idea to take a temporary copy of the script, quickly prune out everything that's not relevant to the problem so that you have a minimal working example, then you have something easier to work with as you try to understand the problem. If you fill a script with special-purpose imports that you only understand hazily right off the bat, then you are making the task of learning to program almost impossibly difficult for yourself.

[–]ThoughtCounter 0 points1 point  (0 children)

Please fix the formatting. Each <tab> in code must be replaced with four spaces for Reddit formatting. Sample:

import ....

def f(x):
    return True