Python Forum
Import all items from all modules from package
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import all items from all modules from package
#2
I've been told that import * is bad form too. Not sure why, but import file is preferred.

I think you can just put them all in one file and import Weapons then set a variables like:

staff = Simple_Melee.quarterstaff
print(staff)
It's bunch of long names in a dictionary, in four modules. Unless you want to do a bunch of renaming or moving I don't know what you can do.

Unless you are going having billions of weapons you might do well just to have them as their own dictionaries in the weapons file, and use """ or # to separate them for your own sake.

That's likely my route. Just a file called Weapons_dicts.py.
Reply


Messages In This Thread
RE: Import all items from all modules from package - by michael1789 - Jan-25-2020, 07:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Different Ways to Import Modules RockBlok 2 580 Dec-11-2023, 04:29 PM
Last Post: deanhystad
  Import Modules TheBunyip 4 1,302 Mar-10-2023, 04:47 PM
Last Post: buran
  a bunch of modules to import Skaperen 2 935 Nov-07-2022, 07:33 PM
Last Post: Gribouillis
  Unable to import sklearn after installing any package ilango 0 1,221 Oct-25-2021, 07:03 AM
Last Post: ilango
  Can't import package hubenhau 1 6,060 Jan-15-2021, 06:23 PM
Last Post: buran
  Did interpreter 'compile' all import modules(from thrid-party) jamesyuan 10 4,469 Oct-19-2020, 10:49 AM
Last Post: jamesyuan
  import scalalib package doesn't work manu_brighter 2 2,955 Apr-17-2020, 06:36 PM
Last Post: snippsat
  Importing module from a package results in import error goghvv 2 2,444 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Can't decide - install modules with Ubuntu package manager (apt) or pip3 in venv Thisisaline 6 3,892 Jul-19-2019, 04:58 PM
Last Post: snippsat
  Import Python Modules zowhair 4 2,868 Jun-27-2019, 06:30 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020