Skip to content Skip to sidebar Skip to footer

Nameerror -- Imported Modules When Script Is Broken Down In Multiple Python Files

It is hard to find a title for this question and hopefully this thread is not a duplicate. I was writing that long script in Python 2.7 (using PyCharm 2016.2.2) for a project and

Solution 1:

The numpy module imported in basic.py has a reference defined only withing basic.py scope. You have to explictly import numpy everywhere you use it.

import basic.py
import numpy
numpy.random.seed(7)
import load_data.py

Post a Comment for "Nameerror -- Imported Modules When Script Is Broken Down In Multiple Python Files"