The global statement is a declaration which holds for the entire current code block. It means that the listed identifiers are to be interpreted as globals. While using global names is automatic if they are not defined in the local scope, assigning to global names would be impossible without global.
Emphasis mine.
So:
import os, string, thread
X=7481
Y=1000
Z=1000
def dosubslot(num):
global X, Y, Z
if X< num+10: Y= num+10
if Y< num+10: Y= num+10
if Z< num+10: Z= num+10
num= Y
print dir()
dosubslot(num)
should be what you need.