Doesn’t work that way, I’m afraid. See this thread.
You could write a very generic OnCollisionEnter() that populates a data table. You can attach scripts from code using AddComponent(). At the end of the day, though, you need to attach some script to catch those collision events.