Skip to content

Instantly share code, notes, and snippets.

@jldupont
Created January 20, 2012 18:43
Show Gist options
  • Save jldupont/1648943 to your computer and use it in GitHub Desktop.
Save jldupont/1648943 to your computer and use it in GitHub Desktop.
Python: access a module's function
import sys
mod=sys.modules[__name__]
fnc=getattr(mod, fnc_name, None)
if fnc is not None:
fnc(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment