As I remember, createGraphics() should work in other p5 methods such as draw() and mousePressed() as well. The problem you have might be you are trying to access p5 methods before p5 is initialized (in setup() usually). You can try ensuring the p5 object is initialized either with instance mode or by making sure setup is called before making other calls to createGraphics() in other objects etc. You can look at #903 about this. And this.
Hmm, it sounds like we should add createGraphics and, given #903, all of P5's constants to the list of symbols we provide error help for in #1130... And we should probably add a link in the friendly error message to the FAQ question that @limzykenneth just linked to!