broken💎shaders
11/17/2025, 9:42 PM.ipynb
Whenever I change my baml src and codegen runs, the running kernel get's confused about types and stuff
My current solution (which isn't perfect, it doesn't always work)
py
import sys
for mod in list[str](sys.modules.keys()):
if mod.startswith("baml_client"):
del sys.modules[mod]
from baml_client.types import *
from baml_client.async_client import b
I put that in a cell. It works sometimes and means I get to avoid restarting my kernel just because i changed some baml classesVaibhav (BAML 🐑)
11/17/2025, 10:57 PMVaibhav (BAML 🐑)
11/17/2025, 10:58 PMautoreload thing, then it should "just work" if you re-run the import cellbroken💎shaders
11/18/2025, 2:59 AM%load_ext autoreload
%autoreload 2
import sys
import os
if '__file__' in globals():
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
else:
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '..')))
from dotenv import load_dotenv
load_dotenv()
import os
os.environ["BAML_LOG"] = "off" # off | error | warn | info | debug | trace
Maybe it cases me issues because baml_client is located in a parent directory? That's why i have to add .. to the syspath