Skip to content

Instantly share code, notes, and snippets.

@marta-krzyk-dev
Last active April 5, 2020 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marta-krzyk-dev/ffe8237e0521da3a96259e1854b17892 to your computer and use it in GitHub Desktop.
Save marta-krzyk-dev/ffe8237e0521da3a96259e1854b17892 to your computer and use it in GitHub Desktop.
Python module import
#This is ecommerce/__init__.py file
#If there is a __init__.py in a folder, it makes it a package :)
#Import single function
#from ecommerce.shipping import calc_shipping
#calc_shipping()
#Import single module
#import ecommerce.shipping
#ecommerce.shipping.calc_shipping()
#Import single module, skip package name
from ecommerce import shipping
shipping.calc_shipping()
#ecommerce/shipping.py
#Function inside shipping module
def calc_shipping():
print("calc_shipping")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment