Rename test_api_key and test_api_url to api_key_btn_connect and api_url_btn_connect Make separate function to set form values, called in settings_to_form Change isinstance to is Call findChildren only once