Hi,
If you have a portal you can use arcgis python API to do it, sample here Layer Attachments | ArcGIS for Developers . Also if you do not have access to portal you can use anything like this following code snippet to do this.
import os
import requests
url = "https://yourfeatureserviceurl"
object_id = 1
attachment = r"13291732970228.jpg"
files = {'attachment': (os.path.basename(attachment), open(attachment, 'rb'), 'application/jpeg')}
params = { "f": "json", "token": "" }
r = requests.post( f"{url}/{object_id}/addAttachment", data=params, files=files )
r.json()
Sucessfull request will have this type of response
{'addAttachmentResult': {'objectId': 7, 'globalId': None, 'success': True}}