title: Is it possible to run server and client part of a socket connection in a single code using threading?
body: <p>I'm trying to write a code which includes simulation of a huge point to point network. I wanted to know if there is a way to write the client part of a code and the server part of the code in a single .py file and use threading to run the simulation. I mean for a single client single server there would be two threads in the program. And one thread is trying to reach the other thread through some port by using sockets. Is this possible? If not what can I do? Because I need to handle lots of servers and clients and I don't know how to manage them if they are running on different .py files. Also we don't know the topology or number of the users in the network till some inputs are given.
  Thank you in advance for your help</p>