As of today, the proper way of doing this is:
import sys, importlib
importlib.reload(sys.modules['foo'])
from foo import bar
Tested on python 2.7, 3.5, 3.6.
More Related Contents:
- open .txt file and place every word within a dictionary [closed]
- Adding a Method to an Existing Object Instance
- ImportError: No module named ‘pygame’
- beyond top level package error in relative import
- Importing from builtin library when module with same name exists
- Is it possible to overload Python assignment?
- Can’t import my own modules in Python
- Can’t import my own modules in Python
- How do you import a file in python with spaces in the name?
- How to import module when module name has a ‘-‘ dash or hyphen in it?
- Why don’t methods have reference equality?
- Use a library locally instead of installing it
- How do I access Class member variables in Python?
- Import Script from a Parent Directory
- Namespaces with Module Imports
- Difference between “import X” and “from X import *”? [duplicate]
- python: how to get information about a function?
- Importing classes from different files in a subdirectory
- What are the parentheses for at the end of Python method names? [duplicate]
- What is a “method” in Python?
- from … import OR import … as for modules
- In Python, when should I use a function instead of a method?
- python: What happens when class attribute, instance attribute, and method all have the same name?
- Python, doing conditional imports the right way
- Adding a method to an existing object instance in Python
- How does a Python set([]) check if two objects are equal? What methods does an object need to define to customise this?
- Are functions objects in Python?
- Same name for classmethod and instancemethod
- using import inside class
- How to bind an unbound method without calling it?