Im planning to create a chatbot for Twitch.tv in Python. Id like to use multiple processes for the different main functionalities (one for the bot itself, and one for the GUI). Every process should have a reference to the other processes in form of a variable inside them. I havent started coding the bot itself, but i tested the multiprocessing with a small example.
Main file:
from BotProcess import botProcess
from GuiProcess import guiProcess
botProcess = botProcess()
guiProcess = guiProcess()
botProcess.guiProcess = guiProcess
guiProcess.botProcess = botProcess
botProcess = botProcess()
guiProcess = guiProcess()
botProcess.guiProcess = guiProcess
guiProcess.botProcess = botProcess
botProcess.start()
guiProcess.start()
BotProcess file:
class botProcess(multiprocessing.Process):
guiProcess = ""
def run(self):
# Run Bot
def someOtherMethod(self):
# doSomething
GuiProcess file:
class guiProcess(multiprocessing.Process):
botProcess = ""
def run(self):
# Display GUI
botProcess.someOtherMethod();
Everytime i try to run a method on another process i get this error message:
AttributeError: 'NoneType' object has no attribute 'someOtherMethod'
Is there an easy way to fix this? Or should i just try something else (for example Threading) instead of Multiprocessing?