using custom config vars?

I’m not sure if I have already asked this, I couldn’t find it in my posts.

Is it possible to have a custom config variable in your prc file and assign a function to it in yuor code, which will run something depending on the value?
Right now I’m parsing the prc again myself just for these custom variables.

myVar = ConfigVariableBool("my-config-var", False, "Sets config var. Default is #f.")
if myVar:
  #do code
  #do other code

See the ConfigVariable* reference pages for more information. The idea is that you declare this variable once, somewhere at the top of your modules, and access that variable directly whenever you need to access the configuration.

I’ve seen that page. I want to read a custom variable from Config.prc, not create it in code.

Right, I know what you wanted. That’s what that does. It creates a configurable option, with a default value, that is automatically read from the prc files. This is the way Panda reads from the Config.prc files.

OK. The default value got me a bit confused, I thought the one from a prc file would be overwritten.