hass.states.set(entity_id, 'state', attributes)
where attributes is a dictionary of attributes.
This of course is assuming you are talking about the python_script integration. If you are talking about a random python script that you made… You might want to consider different ways of getting the information into home assistant. There’s many integration options that probably do what your python script does.