1

I have this class with method just_test

class MyClass:
    def __init__(self):
        pass

    def just_test(self, a: int) -> MyClass:
        return self

I'm not able to declare at the method signature that I return the object I'm working on (the -> MyClass part)

I'm getting "Unresolved Reference MyClass" error from PyCharm.

I've also tried -> self at the method signature, but I get the same error.

I'm using python 3.10

user3364652
  • 480
  • 8
  • 23

1 Answers1

1

At the top of your file put this:

from __future__ import annotations

This will allow the name MyClass to be used inside its implementation.

sanitizedUser
  • 1,723
  • 3
  • 18
  • 33