导入自定义函数时,如何消除自定义函数下面类似于报错的波浪线

导入自定义函数时import sim_function,sim_function下面一直有波浪线

程序能正常运行,但右侧有红色类似报错的信息,显示:

No module named sim_function less... (⌘F1)

Inspection info: This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

解决方法:

应该是项目中无法识别自定义函数所在的路径。所以将其路径添加到项目中就可以了。

在Preferences(即Setting)中以下页面添加自定义函数的路径,添加后,sim_function下面的红色波浪线就消失了

导入自定义函数时,如何消除自定义函数下面类似于报错的波浪线