'How can a client be a server too?

Description: I have just finished a small course about socket and I have an idea to create a trivia game using python. The idea is to let every user to be the host and the client (server and client). For example 3 devices have the program, one shares wifi creating a local network to whom the other 2 devices with the app connect and the device who shares network is the server for all of them and is the client too.

Code: it's a trivia game where the sever gives the question and the client answers. It's multi clients server. (it's 2 long codes)

Question: How to I combine them to be in one program code?

additon: i tried:

import client_side
import server_side
from threading import Thread
def main():
    thread = Thread(server_side.main())
    thread.start()
    client_side.main()

if __name__=='__main__':
    main()'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source