diff --git a/src/runtime/PythonTypes/PyModule.cs b/src/runtime/PythonTypes/PyModule.cs index 243f77ecc..bb539373d 100644 --- a/src/runtime/PythonTypes/PyModule.cs +++ b/src/runtime/PythonTypes/PyModule.cs @@ -59,6 +59,22 @@ internal PyModule(BorrowedReference reference) : this(new NewReference(reference { } + /// + /// Set Variable Method + /// + /// + /// Add a new variable to the variables dict if it not exist + /// or update its value if the variable exists. + /// + public PyModule Set(string name, object? value, Type type) + { + if (name is null) throw new ArgumentNullException(nameof(name)); + + using var _value = Converter.ToPython(value, type); + SetPyValue(name, _value.Borrow()); + return this; + } + /// /// Given a module or package name, import the module and return the resulting object. /// pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy