How to Add data to Customize select filed

I have added a select field to form and i want to add data in it.
I added the code on form validate but its not reflecting on form.

          def validate(self):
		# Call an API
		url = "https://api.compattern.com/api/AssignedResource/Problems"
		response = requests.get(url)
		response.raise_for_status() # check for errors

		# Load JSON data into a Python variable.
		jsonData = json.loads(response.text)
		array = []
		#pprint(jsonData)	
		for i in jsonData['data']:
			array.append(i.get('workOrderNumber'))					
		self.custom_work_order_number = array

custom_work_order_number is the form field name.

I created the method to see array is getting data or not from external API and its working and returning data in array.

@frappe.whitelist()
def GetProblems():
	# Call an API
	url = "https://api.compattern.com/api/AssignedResource/Problems"
	response = requests.get(url)
	response.raise_for_status() # check for errors

	# Load JSON data into a Python variable.
	jsonData = json.loads(response.text)
	array = []
	#pprint(jsonData)	
	for i in jsonData['data']:
		array.append(i.get('workOrderNumber'))
	return array

Please guide me about this

Thanks

@sheerazkaleem you need to use javascript , send the data from python to js , or use the api directly in js and then use this line to change the fields :
frm.set_df_property(“custom_work_order_number ”, “options", [“1”,“2”])

Thanks for reply.
How can we call API in js?

@sheerazkaleem you can google it , it’s easy coding .

@sheerazkaleem start first with static data to see if you can change the select options and they are accepted .

Brother I added the above line in js form refresh for static data but the item not showing on the form.