Is it possible to know where a script was called from?

Pretty much exactly as the subject says.

For example: is there somewhere that records what automation called the script in the same way that the trigger_entity_id tells you what entity changed to trigger an automation?

Thanks.

My example was really just to illustrate what I was asking. It is not the use case I have in mind.