Once you've called start() on your object, the stuff inside that object is running in a separate process, and using methods of that class to "communicate" with it are not really the best way. What you need to do is called inter-process communication (IPC for short) and there is special machinery for doing it correctly.
For Python's multiprocessing module there are two mechanisms for communicating between processes: Pipe and Queue. I would suggest looking into those (e.g. here).
To use the Pipe mechanism in your example, you might do it this way (just a quick illustration) :
class Bot(multiprocessing.Process):
def __init__(self, pipe):
multiprocessing.Process.__init__(self)
self.val = 0
self.ipcPipe = pipe
def run(self):
while True:
newData = self.ipcPipe.recv()
self.val = newData[0]
print 'IN: ', self.val
self.ipcPipe.send([self.val])
time.sleep(2)
if __name__ == '__main__':
parent_conn, child_conn = multiprocessing.Pipe()
bot = Bot(child_conn)
bot.start()
value = 0
while True:
value += 1
parent_conn.send([value])
outVal = parent_conn.recv()
print 'OUT: ', outVal[0]
time.sleep(2)
See what's been done here: We create parent and child "ends" of the Pipe, and give the child end to your object. Then from the parent process you use send() to communicate a new value to the object, and recv() to get an updated value back. Likewise inside your object (a separate process, remember) you conversely use send() and recv() on the pipe's other end to communicate with the parent process.
Also, I would recommend calling Process.__init__(self) in your class __init__ method before doing any other initialization. Since you're inheriting from Process it's a good idea to make sure all the process-y stuff under the hood gets initialized correctly before you do anything in your own class.
Hope this helps.