making pycharn recognize additions to builtins

I am adding a global variable (to be available in all imported modules of a program) by adding it to *builtins*

How do I make pycharm stop complaining about 'unresolved reference' to such variables?


Comment actions Permalink


Please try **File > Invatidate caches / restart**. If this doesn't help, try to delete and re-install PyCharm, and delete and add the interpreter.

Comment actions Permalink

Invalidate caches/restart did not work.  I don't see how re-installing or deleting/adding the interpreter may work. It sounds like an IT answer to everything.

Let me reiterate the question - I add to builtins - e.g.

builtins.log = get_logger('global')

and then I use 

log.warning('beware') in all of my modules.


Pycharm squiggly highlight all of the *log.* instances as unresolved references. 

Comment actions Permalink

Well, in some cases "unresolved" errors are caused by some cache issues, and making PyCharm rebuild caches can help.

But for this case, I did some testing, and it appears to be a known issue, here's a similar ticket:

Feel free to leave a vote and comment. I should note that modifying builtins is not a common practice, there should be a better alternative.


Please sign in to leave a comment.