Since the two RPi's are supposed to move (if I understand correctly) you will need some wireless communication (dragging wires through the maze is not a good idea...). Probably the easiest approach will be using wifi modules and a wifi accesspoint/router. (your other option is Bluetooth, but getting it configured on RPi to communicate with another would be an uphill battle - as would be getting the WiFi modules to talk to each other, without using any accesspoint)
Thanks to wifi modules and the router, both RPis will have network connectivity. Make sure to configure either them, or DHCP of the router to assign them specific IP addresses (and not randomly picked from free DHCP pool - most WiFi routers feature such option.)
With WiFi and specific addresses, the Raspberry Pi can communicate with each other over TCP/IP - or in other words, "over the Internet".
From then on, your task will be programming the communication in Python (there's no point for any other language since you'll be using Python for everything else anyway). The example piece of communication code:
Server (e.g. "cat"):
# Echo server program
import socket
HOST = '' # Symbolic name meaning all available interfaces
PORT = 50007 # Arbitrary non-privileged port
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connected by', addr
while 1:
data = conn.recv(1024)
if not data: break
conn.sendall(data)
conn.close()
Client (e.g. "mouse"):
# Echo client program
import socket
HOST = 'daring.cwi.nl' # The remote host
PORT = 50007 # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.sendall('Hello, world')
data = s.recv(1024)
s.close
[source]
In place of HOST = 'daring.cwi.nl' you'd put the IP address of 'server'. Observe sendall and recv in the above code: that's where you send or receive data between the two sides. Instead of just sending it back and forth, you'll be making other use of it in your code. Details of using Python for the remainder of your project probably exceed the scope of this question.
In case your raspberries don't need to move, probably a solution easier than WiFi would be connecting them over RS232 (Connect pins 8 <-> 10, 10 <-> 8, read/write to /dev/ttyS0 ) - but RS232 is ill-suited for wireless communication, and besides you will likely need network connectivity anyway, and WiFi provides that - not just the Pis can communicate with each other, you can communicate with them from any PC.