How do i draw anything with a script?

i wanna know how the hell do i make my code draw something, graphicscontext that seemed to be the option doesnt work, i tried image:drawsprite/drawimage but that also doesnt seem to work, and i could swear that there were scripts that made these kinds of things possible before, is it the api just deprecated in those features or smt?

Aseprite can draw programmatically using the app.useTool script command. You mean this?