# How to access the client with custom code

**URL:** <https://discuss.elastic.co/t/how-to-access-the-client-with-custom-code/170744>\
**Category:** APM\
**Created:** [March 4, 2019, 2:50pm UTC](https://discuss.elastic.co/t/how-to-access-the-client-with-custom-code/170744 "2019-03-04T14:50:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![commentator8](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@commentator8](https://discuss.elastic.co/u/commentator8)\
**Post date:** [March 4, 2019, 2:50pm UTC](https://discuss.elastic.co/t/how-to-access-the-client-with-custom-code/170744/1 "2019-03-04T14:50:43Z")

</div>

I am trying to use APM with custom python code, and am wondering what is the recommended way of doing so? Should each class either create a client instance or receive it as a parameter? Is there any way of creating it the once and accessing it (like with the logging library)?

Also - if i wish to disable APM in a production scenario - what is the easiest way of doing so?

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 25, 2019, 10:50am UTC](https://discuss.elastic.co/t/how-to-access-the-client-with-custom-code/170744/2 "2019-03-25T10:50:53Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
