-
-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Labels
Description
VS Code, Pylance is giving errors trying to use enums from rna_enums module, see an example below.
import bpy
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import bpy._typing.rna_enums as rna_enums
class SimpleOperator(bpy.types.Operator):
bl_idname = "wm.simple_operator"
bl_label = "Simple Operator"
# OperatorReturnItems" is not exported from module "bpy._typing.rna_enums" PylancereportPrivateImportUsage
# (type) OperatorReturnItems = Literal['RUNNING_MODAL', 'CANCELLED', 'FINISHED', 'PASS_THROUGH', 'INTERFACE']
def execute(self, context) -> set["rna_enums.OperatorReturnItems"]:
print("Hello from the simplest operator!")
return {"FINISHED"}
# Register the operator
bpy.utils.register_class(SimpleOperator)