Skip to main content

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


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

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page