Unable to automate converting a duplicated and seperated mesh into a curve with python
Assume that you just selected one object to do the procedure:
Then after the separation, the new created object will be &quot;selected&quot; by default, but not active. You can check whether your selected object is not active, then that should be the one you've separated.
# After separation
C = bpy.context # select a correct context first
for obj in [
    o for o 
    in C.selected_objects 
    if o is not C.view_layer.objects.active #remove active object from list
]:
    C.view_layer.objects.active = obj
    # you can do further comparison here to make sure you select the right object
    break # Break before accessing other
# Do the rest of the code