Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Get an object by name or dotted path, import if it necessary.

Project description

Get an object by name or dotted path, import if it necessary.

Install

pip install object_by_name

Usage

>>> from object_by_name import object_by_name
>>> object_by_name('test_package')
<module 'test_package' from ...>
>>> object_by_name('test_package.test_module')
<module 'test_package.test_module' from ...>
>>> object_by_name('test_package.test_module.TestClass')
<class 'test_package.test_module.TestClass'>
>>> object_by_name('test_package.test_module.instance')
<test_package.test_module.TestClass object at 0x...>
>>> object_by_name('test_package.test_module.instance.method')
<bound method TestClass.method of <test_package.test_module.TestClass ...>>

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for object_by_name, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size object_by_name-0.0.1.tar.gz (1.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page