# Removing item from bpy.app.driver_namespace

Was wondering if there is a less vigorous way of removing an item from the driver namespace, perhaps using pop() or popitem()?

import bpy

dns = bpy.app.driver_namespace
dnc = dns.copy()

# clear dns
dns.clear()

#remake with any key beginning with "ST_" removed

for k, v in dnc.items():
if k.startswith("ST_"):
continue
dns[k] = v


### Edit

Looks like dns.update(...) is the go:

D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
In either case, this is followed by: for k in F:  D[k] = F[k]


which gives me:

import bpy

dns = bpy.app.driver_namespace
dnc = {k:v for (k, v) in dns.items() if k.startswith("ST_")}

dns.update(dnc)


Both of these are ok for a 'startswith search', but seem overkill if I know the name of the item I want to remove.

del bpy.app.driver_namespace['driverFunc']