Skip to content

Commit bdb11d0

Browse files
don't import from same module
1 parent 639e42e commit bdb11d0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

codeflash/code_utils/code_extractor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ def add_needed_imports_from_module(
331331
RemoveImportsVisitor.remove_unused_import(dst_context, mod)
332332
for mod, obj_seq in gatherer.object_mapping.items():
333333
for obj in obj_seq:
334-
if f"{mod}.{obj}" in helper_functions_fqn:
334+
if (
335+
f"{mod}.{obj}" in helper_functions_fqn or dst_context.full_module_name is mod
336+
): # avoid circular imports
335337
continue # Skip adding imports for helper functions already in the context
336338
AddImportsVisitor.add_needed_import(dst_context, mod, obj)
337339
RemoveImportsVisitor.remove_unused_import(dst_context, mod, obj)

0 commit comments

Comments
 (0)