It would depend on whether the DM is okay with temporary inability to use class features, which is not really how the game is supposed to work, not in essence. Now, you do get items like the Tomes of X that inherently boost your abilities, ie permanent magical increases. These are rare and costly items, for a good reason.
Now, if your campaign is the kind where the players are hopped up on class features in the way that certain "performance medicines" give you increased abilities, then that's another matter. In a campaign with enhanced performance while affected by a magic item, substance, or class features that rely on abilities, and the only way to get those is to take a certain substance or use magic, then that's a design decision, and it goes against the spirit of the game, as I understand it (15 years experience here). I'm not saying it's strictly outlawed, but generally, you want to streamline play with as few headaches/chances for confusion as possible, so as to not get bogged down in arguments and more philosophical (but generally polite) conversations about the concepts of class level and ability.
In general, as intended, it would make sense that they design the game to rely on the abilities in a more permanent manner than magic/substances etc would be able to provide, unless that's the idea of the particular campaign.
So magic = drugs, kids. :p
PS: if you can create a character concept where they get their class abilities from temporary buffs, then that's also more likely to work out well in your favour. But that's not what 9 out of 10 DM's would go for, I imagine, if they're the kind who want to minimize headaches anyway. (Namely, their own.)