Experimental / module_writer.py
Ananthusajeev190's picture
Upload 21 files
e74e0c7 verified
import os
MODULE_DIR = os.path.join(os.path.dirname(__file__), "../modules")
class ModuleWriter:
def __init__(self):
self.dir = MODULE_DIR
def create_module(self, name, content):
filename = os.path.join(self.dir, f"{name}.py")
with open(filename, "w") as f:
f.write(content)
return f"Module {name} created."
def list_modules(self):
return [f for f in os.listdir(self.dir) if f.endswith(".py")]