NameError: name 'Object' is not defined

When I import unreal, I met the error:
How can I solve it?

Traceback (most recent call last):
  File "xx.py", line 1, in <module>
    import unreal
  File "E:\xx\unreal.py", line 61, in <module>
    def find_object(outer: Optional[Object], name: str, type: Union[Class, type] = Object.static_class(), follow_redirectors: bool = True) -> Any:
NameError: name 'Object' is not defined

Greetings @Oscarrr11211

With that error, try changing Object to lowercase (object). Let me know if that fixes it.

I figure it out. The file unreal.py doesn’t play the role bridging the C++ and python. So, I cannot run the code in IDE directly. When I invoke the function in unreal, it can work.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Oh, I see! I’m glad that you were able to resolve the issue. Thanks for posting the solution as well. This helps our community when other designers run into the same problem and come to the forums. Thank you!