for running this script behind when a request is done or on clicking a button in a desktop application this file runs in the background and opens the system wifi setting in windows 10
Use the winwifi: https://github.com/changyuheng/winwifi.py
Installation:
pip install winwifi
Now you could try connecting a known wifi:
import winwifi
winwifi.WinWiFi.connect('ssid_or_name_of_the_router')