Fix Python – 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 to work on Google App Engine.
Preferably this would be a function that accepts the FQN of the class as a string, and returns a reference to….

Fix Python – What’s the correct way to sort Python `import x` and `from x import y` statements?

The python style guide suggests to group imports like this:

Imports should be grouped in the following order:

standard library imports
related third party imports
local application/library specific imports

However, it does not mention anything how the two different ways of imports should be laid out:
from foo import bar
import foo

There are m….

Fix Python – ModuleNotFoundError: What does it mean __main__ is not a package?

I am trying to run a module from the console. The structure of my directory is this:

I am trying to run the module, from the problem_set_02 directory using:
$ python3

The code inside p_03_using_bisection_search.pyis:
__author__ = ‘m’

from .p_02_paying_debt_off_in_a_year import compu….

Fix Python – Sibling package imports

I’ve tried reading through questions about sibling imports and even the
package documentation, but I’ve yet to find an answer.
With the following structure:
├── api
│   ├──
│   ├──
│   └──
├── examples
│   ├──
│   ├──
│   └──
└── tests
│   ├── __in….

Fix Python – Relative imports – ModuleNotFoundError: No module named x

This is the first time I’ve really sat down and tried python 3, and seem to be failing miserably. I have the following two files: has a few functions defined in it as well as a few variables. I’ve stripped it down to the following:
debug = True
import config
print (config.debug)

I also have an __in….