Skip to main content

Using Modules

  • Chapter
  • First Online:
Lean Python
  • 10k Accesses

Abstract

Once you have more than a hundred (or several hundred) lines of code in one Python file, it can be a little messy to manage all the functions and classes in the same place. Splitting your code over two or more module files that each cover one aspect of the functionality can simplify matters greatly.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 24.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 34.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The import statement assumes your module files end with '.py'.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Paul Gerrard

About this chapter

Cite this chapter

Gerrard, P. (2016). Using Modules. In: Lean Python. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2385-7_5

Download citation

Publish with us

Policies and ethics