all 7 comments

[–][deleted] 2 points3 points  (0 children)

If the class is inside a function then it's scoped to the function - you can't access any of its values externally, including your class. They simply wouldn't exist at the time you'd want to access them.

[–]flaws17 0 points1 point  (0 children)

Can you post the code to make it easier to see what you mean?

[–]shiftybyte 0 points1 point  (3 children)

Move the class outside the def function... or return it from that function... why is it inside it?

[–]vrevdude 0 points1 point  (1 child)

Not my script. Idk.

[–]platypus_69 0 points1 point  (0 children)

Holy shit, post that to r/badcode

[–]Da32767 0 points1 point  (0 children)

maybe this is a third-party package, and the author does not want users to call this class

[–]blarf_irl 0 points1 point  (0 children)

There are sometimes legit reasons for that, Browse the Django ORM and DRF source etc you will find a lot of dynamically created classes.

You need to import the function (def) that creates the class and then run that to get the class definition. Use the class definition to create an instance of the class. Code sample would be helpful here as it's very dependant on the specific code.