How to Create Shared Python Library

323
4
Jump to solution
02-25-2020 11:53 AM
MarianneCardwell
New Contributor III

I've been a C#/ArcObjects developer most of my career and am finally starting to switch to Python and ArcPy, so I'm still fairly new to that world. I'm creating a bunch of tools that are used by multiple people. Is there a way for me to create a library of common functions that my geoprocessing tools can call? If so, how can I make sure that my users will have the necessary files on their computers? We store our toolboxes and scripts on the network, in case that makes a difference.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
BlakeTerhune
MVP Regular Contributor

You can indeed create your own modules and import them just like you do with the built-in modules.

Python Modules: Learn to Create and Import Custom and Built-in Modules 

The location of the file needs to be in the module search path if the computer's Python environment.

View solution in original post

4 Replies
BlakeTerhune
MVP Regular Contributor

You can indeed create your own modules and import them just like you do with the built-in modules.

Python Modules: Learn to Create and Import Custom and Built-in Modules 

The location of the file needs to be in the module search path if the computer's Python environment.

MarianneCardwell
New Contributor III

Thanks Blake! How/where do you store the modules so everyone has access to them?

0 Kudos
BlakeTerhune
MVP Regular Contributor

Here's an article that goes a little more in-depth on how to save the files so they can be imported.

https://stackabuse.com/python-modules-creating-importing-and-sharing/#usingamodule 

MarianneCardwell
New Contributor III

Thank you so much, Blake, this is perfect!