Try the inspect module. getmembers and the various tests should be helpful.

EDIT:

For example,

class MyClass(object):
    a = '12'
    b = '34'
    def myfunc(self):
        return self.a

>>> import inspect
>>> inspect.getmembers(MyClass, lambda a:not(inspect.isroutine(a)))
[('__class__', type),
 ('__dict__',
  <dictproxy {'__dict__': <attribute '__dict__' of 'MyClass' objects>,
   '__doc__': None,
   '__module__': '__main__',
   '__weakref__': <attribute '__weakref__' of 'MyClass' objects>,
   'a': '34',
   'b': '12',
   'myfunc': <function __main__.myfunc>}>),
 ('__doc__', None),
 ('__module__', '__main__'),
 ('__weakref__', <attribute '__weakref__' of 'MyClass' objects>),
 ('a', '34'),
 ('b', '12')]

Now, the special methods and attributes get on my nerves- those can be dealt with in a number of ways, the easiest of which is just to filter based on name.

>>> attributes = inspect.getmembers(MyClass, lambda a:not(inspect.isroutine(a)))
>>> [a for a in attributes if not(a[0].startswith('__') and a[0].endswith('__'))]
[('a', '34'), ('b', '12')]

...and the more complicated of which can include special attribute name checks or even metaclasses ;)

Answer from Matt Luongo on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_func_getattr.asp
Python getattr() Function
Python Examples Python Compiler ... getattr(Person, 'age') Try it Yourself » · The getattr() function returns the value of the specified attribute from the specified object....
Discussions

introspection - Get all object attributes in Python? - Stack Overflow
Is there a way to get all attributes/methods/fields/etc. of an object in Python? vars() is close to what I want, but it doesn't work unless an object has a __dict__, which isn't always true (e.g. ... More on stackoverflow.com
🌐 stackoverflow.com
Any way to get ALL attributes of an object in python?
movieobject.__dict__ will give you al the attributes and their values movieobject.__dict__.keys() will give you only the names of the attributes. More on reddit.com
🌐 r/learnpython
10
9
June 20, 2024
Accessing attributes of a class
How do I access the attributes of a class, such as, __bases__, __name__, __qualname__? When I do this, class C: pass dir(C) then it gives me, ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', ... More on discuss.python.org
🌐 discuss.python.org
10
0
February 22, 2022
python - List attributes of an object - Stack Overflow
I want this to see the current attributes from various parts of a script. ... Virtually everyone in Python names their classes like NewClass. You may defy people's expectations if you use a naming convention like new_class. ... Even though it is human-interactive and cannot be programatically used, help() function helps for getting ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GeeksforGeeks
geeksforgeeks.org › accessing-attributes-methods-python
Accessing Attributes and Methods in Python - GeeksforGeeks
March 29, 2025 - Let's explore them one by one. Attributes can be accessed, modified or deleted dynamically using built-in functions. getattr(obj, attr, default): Retrieves an attribute's value; returns default if missing.
🌐
Enterprise DNA
blog.enterprisedna.co › python-get-all-attributes
Python: Get All Attributes Explained With Examples – Master Data Skills + AI
This can be useful for debugging, documentation, or other purposes where having a comprehensive view of an object’s attributes is necessary. Utilizing these functions not only streamlines coding processes but also helps in understanding the structure and behavior of Python objects. By learning how to effectively use built-in functions like dir() and getattr(), Python developers can save time and enhance their code management practices.
🌐
Stack Abuse
stackabuse.com › bytes › get-all-object-attributes-in-python
Get All Object Attributes in Python
August 24, 2023 - Getting all of the attributes of an object in Python can be achieved in several ways. Whether you're using dir(), the __dict__ attribute, overriding the str function, or using the vars() function, Python provides a variety of tools to extract and manipulate object attributes.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-get-a-list-of-class-attributes-in-python
How to Get a List of Class Attributes in Python? - GeeksforGeeks
July 12, 2025 - Number has three class attributes and one instance attribute set in __init__. The show() method prints all attributes. Creating n with attr=2 and calling n.show() displays them while vars(n) shows only the instance attributes.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › any way to get all attributes of an object in python?
r/learnpython on Reddit: Any way to get ALL attributes of an object in python?
June 20, 2024 -

I'm using the plex python library to get some info from my plex server.

What I wanted to get was the path of a movie.

I tried to use dir(movie_object), vars(movie_object), and movie_object.__dict__ to try and find all of the movie attributes, and to see where the path was stored.

But there was no attribute that contained the file path information.

In the end I found it under movie_object.location by inspecting the object in the VSCode debugging tools.

Why does VSCode show the location attribute, but dir, vars, or __dict__ do not show it?

Is there a way to reliably get ALL of an objects attributes in python?

🌐
Python.org
discuss.python.org › python help
Accessing attributes of a class - Python Help - Discussions on Python.org
February 22, 2022 - When I do this, class C: pass dir(C) then it gives me, ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', ...
🌐
Flexiple
flexiple.com › python › print-object-attributes-python
How to Print Object Attributes in Python? - Flexiple
March 22, 2024 - In this example, dir(sample_object) will list all attributes and methods of sample_object, including those inherited from its class. getattr(sample_object, 'value') will retrieve the value of the value attribute of sample_object.
🌐
Quora
quora.com › How-do-I-get-a-complete-list-of-objects-methods-and-attributes-in-Python
How to get a complete list of object's methods and attributes in Python - Quora
A python geek. · Author has 718 answers and 266K answer views · 3y · For the complete list of attributes, the short answer is: no. The problem is that the attributes are actually defined as the arguments accepted by the getattr built-in function. As the user can reimplement __getattr__, suddenly allowing any kind of attribute, there is no possible generic way to generate that list.
🌐
Bobby Hadz
bobbyhadz.com › blog › python-get-attributes-of-object
Get all Attributes or Methods of an Object in Python | bobbyhadz
April 10, 2024 - Last updated: Apr 10, 2024 Reading time·6 min · Use the dir() function to get all attributes of an object, e.g. print(dir(object))
🌐
Thedigitalcatonline
thedigitalcatonline.com › blog › 2015 › 01 › 12 › accessing-attributes-in-python
The Digital Cat - Accessing attributes in Python
January 12, 2015 - This usually happens when writing debuggers or inspection tools that let the user interactively specify the attributes they want to see. To perform this "indirect" access Python provides the getattr() builtin function, which accepts an object and the name of an attribute.
🌐
Python documentation
docs.python.org › 3 › reference › datamodel.html
3. Data model — Python 3.14.3 documentation
These are the types to which the function call operation (see section Calls) can be applied: A user-defined function object is created by a function definition (see section Function definitions). It should be called with an argument list containing the same number of items as the function’s formal parameter list. Most of these attributes check the type of the assigned value: Function objects also support getting and setting arbitrary attributes, which can be used, for example, to attach metadata to functions.
🌐
Python Central
pythoncentral.io › how-to-get-an-attribute-from-an-object-in-python
How to get an attribute from an object in Python - Python Central
December 29, 2021 - How to get the value of an attribute of an object in Python. Using the getattr function, versus other ways to get an attribute of an object in Python.
🌐
pythoncodelab
pythoncodelab.com › home › get attributes of object python
Get attributes of object Python - pythoncodelab
November 2, 2025 - Learn how to get all attributes of object Python using dir(), __dict__, and getattr(). Includes examples for class, bytes, list, and dynamic access.
🌐
DigitalOcean
digitalocean.com › community › tutorials › python-getattr
Python getattr() | DigitalOcean
August 3, 2022 - Python getattr() function is used to get the value of an object’s attribute and if no attribute of that object is found, default value is returned. Basically, returning the default value is the main reason why you may need to use Python getattr() function.
🌐
W3Schools
w3schools.com › python › python_class_properties.asp
Python Class Properties
Python Functions Python Arguments Python *args / **kwargs Python Scope Python Decorators Python Lambda Python Recursion Python Generators Code Challenge Python Range ... Matplotlib Intro Matplotlib Get Started Matplotlib Pyplot Matplotlib Plotting Matplotlib Markers Matplotlib Line Matplotlib Labels Matplotlib Grid Matplotlib Subplot Matplotlib Scatter Matplotlib Bars Matplotlib Histograms Matplotlib Pie Charts
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-print-object-attributes-in-python
How to Print Object Attributes in Python - GeeksforGeeks
July 23, 2025 - This article will guide you through various methods to print object attributes in Python.