PyCharm fake syntax error using turtle
The function forward()
is available for import by specifying __all__
the turtle
corresponding part from the source code in the module :
_tg_turtle_functions = [..., 'forward', ...] __all__ = (_tg_classes + _tg_screen_functions + _tg_turtle_functions + _tg_utilities + _math_functions)
Currently pycharm cannot see the objects listed in the module list __all__
and therefore marks them as unresolved reference
. It has a bugtracker problem:
Make a function from a method: update __all__ if it exists to use as a noticed import
See also: Can someone explain __all__ in Python?
FYI, you can add a comment noinspection
to tell Pycharm not to mark it as an unresolved link:
from turtle import *
#noinspection PyUnresolvedReferences
forward(100)
done()
Or disable scanning for a specific area .
And of course, strictly speaking, you should follow PEP8 and avoid wildcard imports :
import turtle
turtle.forward(100)
turtle.done()
source to share