import importlib.util import os def run_module(module_path, module_name): spec = importlib.util.spec_from_file_location(module_name, module_path) mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) if hasattr(mod, 'main'): mod.main() else: print(f"[WARN] {module_name} has no main() function.") def main(): this_dir = os.path.dirname(os.path.abspath(__file__)) finhub_dir = os.path.join(this_dir, 'finhub') modules = [ ('company_info.py', 'company_info'), ('sentiment.py', 'sentiment'), ('ratings.py', 'ratings'), ('quote.py', 'quote'), ] for fname, mname in modules: print(f"[INFO] Merging {mname.replace('_', ' ')}...") run_module(os.path.join(finhub_dir, fname), mname) print("[INFO] All merges complete.") if __name__ == "__main__": main()