From 4754c6b3e25f9f02e8a59022b7d280d976b13f91 Mon Sep 17 00:00:00 2001 From: Kelly Date: Tue, 25 Aug 2026 11:34:17 -0700 Subject: [PATCH] Update radio.py --- modules/radio.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/modules/radio.py b/modules/radio.py index edcdd6e..ac69655 100644 --- a/modules/radio.py +++ b/modules/radio.py @@ -152,15 +152,8 @@ if radio_detection_enabled: if voxDetectionEnabled: # methods available for trap word processing, these can be called by VOX detection when trap words are detected - from mesh_bot import tell_joke, handle_wxc, handle_moon, handle_sun, handle_riverFlow, handle_tide, handle_satpass - botMethods = { - "joke": tell_joke, - "weather": handle_wxc, - "moon": handle_moon, - "daylight": handle_sun, - "river": handle_riverFlow, - "tide": handle_tide, - "satellite": handle_satpass} + # Import moved inside checkVoxTrapWords() to avoid circular import from mesh_bot + botMethods = None # Will be initialized in checkVoxTrapWords() # module global variables previousVoxState = False voxHoldTime = signalHoldTime @@ -257,6 +250,20 @@ def get_sig_strength(): def checkVoxTrapWords(text): try: + # Initialize botMethods on first call to avoid circular import from mesh_bot + global botMethods + if botMethods is None and voxDetectionEnabled: + from mesh_bot import tell_joke, handle_wxc, handle_moon, handle_sun, handle_riverFlow, handle_tide, handle_satpass + botMethods = { + "joke": tell_joke, + "weather": handle_wxc, + "moon": handle_moon, + "daylight": handle_sun, + "river": handle_riverFlow, + "tide": handle_tide, + "satellite": handle_satpass + } + if not voxOnTrapList: logger.debug(f"System: RadioMon: VOX detected: {text}") return text