Skip to content

Accessing class attributes within nested classes: AttributeError: 'getset_descriptor' object has no attribute '...' #4360

Answered by alex
DavidAntliff asked this question in Questions
Discussion options

You must be logged in to vote
#[pyclass]
struct System {
    #[pyo3(get)]
    Cpu: Cpu,
}

This puts a Cpu attribute on instances of System, it doesn't put it on the System class itself.

You need to use something like classattr to put an attribute on the class.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@DavidAntliff
Comment options

@DavidAntliff
Comment options

Answer selected by DavidAntliff
Comment options

You must be logged in to vote
1 reply
@DavidAntliff
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants