scy,
@scy@chaos.social avatar

Also, while in Python 2 packages had to have an init.py file (which is what made them a package), this is no longer true for Python 3. init.py files are completely optional.

An init.py file is being interpreted the first time some module from your package is imported. But it's also what allows you to import (from) a package instead of a module.

Many packages use this to provide easier access to things defined in sub-modules, which can be extra confusing for inexperienced devs.

Five example commands, all running from the top directory. "python3 mod_import.py" prints "

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • DreamBathrooms
  • ngwrru68w68
  • modclub
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • GTA5RPClips
  • JUstTest
  • tacticalgear
  • normalnudes
  • tester
  • osvaldo12
  • everett
  • cubers
  • ethstaker
  • anitta
  • Leos
  • provamag3
  • cisconetworking
  • megavids
  • lostlight
  • All magazines