@Jean-Marc @jacob.small @Nick_Boyts
Hello, How do I convert my input string to Type? Any suggestions, please.
Someone else may know better than me, but as far as I know you can’t directly convert a string to a class… it’s not a 1:1 relationship like that. Hopefully someone else has some better news for you, as my proposed work-around isn’t very elegant.
What you can do is use the inspect module to probe the entirety of your environment’s current classes for a given module, and then test each of the resulting class names against a desired variable, returning only values which align, and then use list indexing to pull the class itself instead of the name from the returned data.
The better question than “how” is “why”. If someone types “PrintSettings”, or “Print Setting”, or any other non-perfectly aligned value, you’re going to get bad results. In this case, editing the Python code is likely WAY better than editing a string as it will facilitate results faster. In any case…