QObject::setParent: Cannot set parent, new parent is in a different thread

I want to create button when socket received data.
And I used threading to make socket client.
But, this method seems to be causing problem
How can I solve this problem?

import sys
import threading
import socket
from PyQt5 import QtWidgets, QtCore, uic
from functools import partial
import time

class window(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        self.setupUI()
        
    def setupUI(self):
        self.setWindowTitle("test")
        self.show()

    def createbutton(self):
        self.btn = QtWidgets.QPushButton(self)
        self.setGeometry(100, 100, 500, 500)
        self.btn.setGeometry(100, 100, 100, 100)
        self.show()

def sock(win):
    print("1")
    HOST = "127.0.0.1"
    PORT = 29384
    client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    client_socket.bind((HOST, PORT))
    client_socket.listen()
    while True:
        print("2")
        client_socket, addr = client_socket.accept()
        data = client_socket.recv(1024)
        if data:
            print(data.decode())
            win.createbutton()
            break

app = QtWidgets.QApplication(sys.argv)
w = window()
s = threading.Thread(target=sock, args=(w, ))
s.start()
sys.exit(app.exec_())