def METHOD_NAME(modules: dict, module_name: str, global_signals: set):
    GS = 'global_signals'
    if GS in modules[module_name]:
        modules[module_name][GS].update(global_signals)
    else:
        modules[module_name][GS] = set(global_signals)
    for instance in modules[module_name]['instances']:
        sub_module_name = instance['abstract_template_name']
        if sub_module_name in modules:
            signals_to_propagate = set()
            for formal_actual in instance['fa_map']:
                formal = formal_actual['formal']
                actual = formal_actual['actual']
                if actual in global_signals and formal not in modules[sub_module_name].get(GS, set()):
                    signals_to_propagate.add(formal)
            if signals_to_propagate:
                METHOD_NAME(modules, sub_module_name, signals_to_propagate)