Keeping track of windows and/or threads? - Printable Version
+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Add-ons (/forumdisplay.php?fid=26)
+--- Thread: Keeping track of windows and/or threads? (/showthread.php?tid=17733)
- hexperience - 2006-01-28 08:39
does anyone know of a way to keep track of a script running in the background?
the script i'm working on starts a big download, i then close all the windows and my download keeps going, as i want it to, but i can't see how to get back to that thread. it just keeps running until it completes or i reboot the xbox.
i'd like a way to break back into the script at the correct spot.
if i restart my script when it's already downloading, i end up with two threads running at the same time. (this only works if started from the submenu). if i could control those some how it would be great.
- firstname.lastname@example.org - 2006-01-28 14:40
depends on how your script works, but you can have other scripts refer to class's in other scripts running, so you could redo "class.domodel()" from another script, or grab varibles from that class/script
- hexperience - 2006-01-29 07:03
so as a really simple example (because i'm pretty simple)...
i have one script that just counts up a number in an infinate while loop:
x = x + 1
i can start up a second script and reference x so that i can see how far it's counted? i've tried that but x always seems to be the same number.
each time i run check.py it will tell me the current value of x?
thanks for any help...
ps. i know this code is not correct to run in xbmc... just used for example.
- email@example.com - 2006-01-29 20:55
dont need to import, well i dont do it, i would just try a nother script with:
and it will print x in another script
just make x a global varibale
- neonerz - 2006-01-29 21:23
i've been trying to do the same thing but i couldn't get it to work. i couldn't even get it to work within the same script but with two classes, example
x = 'test'
dosen't work. i even tried
y = firstclass()
i'm still pretty new to python, so i'm sure this is a pretty easy thing to do.
- firstname.lastname@example.org - 2006-01-29 21:53
try adding "global x" to the script before the classses in both scripts.
sorry and adding "global x" at the begining of the classes too eg...
x = 'test'
- hexperience - 2006-01-30 14:53
(email@example.com @ jan. 29 2006,18:55 Wrote:dont need to import, well i dont do it, i would just try a nother script with:
i wouldn't have thought that would work, but it does. i was thinking that each script was getting it's own instance of the interpreter so that scripts were completely separate from each other. thanks very much! this gives me a whole new design to my script, which should work out nicely.
- firstname.lastname@example.org - 2006-01-30 15:50
yea i discovered it by mistake lol but it works but i didnt think it would good luck