diff --git a/crossplane/function/runtime.py b/crossplane/function/runtime.py index fe6d02f..a6e465e 100644 --- a/crossplane/function/runtime.py +++ b/crossplane/function/runtime.py @@ -95,7 +95,10 @@ def serve( are supplied. """ # Define the loop before the server so everything uses the same loop. - loop = asyncio.get_event_loop() + try: + loop = asyncio.get_event_loop() + except RuntimeError: + loop = asyncio.new_event_loop() server = grpc.aio.server(options=options)