Tag: python-import
Posts of Tag: python-import
  1. Python: reload component Y imported with 'from X import Y'?

    In Python, once I have imported a module X in an interpreter session using import X, and the module changes on the outside, I can reload the module with reload(X). The changes then become available in my interp...Learn More
  2. What exactly does "import *" import?

    In Python, what exactly does import * import? Does it import __init__.py found in the containing folder? For example, is it necessary to declare from project.model import __init__, or is from project.model imp...Learn More
  3. Good or bad practice in Python: import in the middle of a file

    Suppose I have a relatively long module, but need an external module or method only once. Is it considered OK to import that method or module in the middle of the module? Or should imports only be in the first ...Learn More
  4. List all the modules that are part of a python package?

    Is there a straightforward way to find all the modules that are part of a python package? I've found this old discussion, which is not really conclusive, but I'd love to have a definite answer before I roll out...Learn More
  5. Python import error: no module named

    I am very new at Python. I have an existing example project that has the scripts YYY in path XXX/YYY, and a script A.py that call these one by one. I only want to add a script ZZZ.py to the YYY scripts so that ...Learn More
  6. Dynamic loading of python modules

    In python how do you dynamically add modules to a package while your programming is running. I want to be able to add modules to the package directory from an outside process, and be able to use those new modul...Learn More
  7. Python: How to import other Python files

    How do I import other files in Python? How exactly can I import a specific python file like import file.py? How to import a folder instead of a specific file? I want to load a Python file dynamically in runtim...Learn More
  8. What's Python good practice for importing and offering optional features?

    I'm writing a piece of software over on github. It's basically a tray icon with some extra features. I want to provide a working piece of code without actually having to make the user install what are essential...Learn More
  9. module reimported if imported from different path

    In a big application I am working, several people import same modules differently e.g. import x or from y import x the side effects of that is x is imported twice and may introduce very subtle bugs, if someone ...Learn More
  10. How to dynamically load a Python class

    Given a string of a Python class, e.g. my_package.my_module.MyClass, what is the best possible way to load it? In other words I am looking for a equivalent Class.forName() in Java, function in Python. It needs ...Learn More
  11. Properly importing modules in Python

    How do I set up module imports so that each module can access the objects of all the others? I have a medium size Python application with modules files in various subdirectories. I have created modules that a...Learn More
  12. How can I make the PyDev editor selectively ignore errors?

    I'm using PyDev under Eclipse to write some Jython code. I've got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ISubInterface T...Learn More