Dynamic Class Creation: 'Unresolved attribute reference'

Answered

Hi, I was wondering if there is a function that allows PyCharm to pick up on parent attributes of a dynamically created class using NewClass = type('NewClass, (SuperClass1, Superclass2), {}), where SuperClass2 can pick up the attributes of SuperClass1?

I have some code in the screenshot (apologies, it's not a minimal example) where the highlighted section on the right is creating new classes dynamically, but the Circle class on the left doesn't seem to realise that it is being used as part of a new class, and hence still has unresolved attribute references.

This would be a useful feature to help keep track of attributes.

Thanks and kind regards,

Tim

 

1 comment

Hi,

This is currently not supported. There is a corresponding feature request about that https://youtrack.jetbrains.com/issue/PY-30623, please vote for it and follow for updates. 

See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

0

Please sign in to leave a comment.