Python Using methods from other modules -


i have 2 modules called dfs , graph. in graph module, have class graph , method called readgraph. in dfs module, have method calls on readgraph following error message when type: dfs.processgraph(testcase.txt,verbose=true)

error message: nameerror: name 'testcase' not defined

could explain how fix this?

thanks.

from dfs.py module:

import sys  graph import *  class dfs( object ):     def processgraph(file_name, verbose):       g=readgraph(file_name) 

from graph.py module:

class graph( object ):     def readgraph( file_name ): 

remove class declaration graph.py. when import file top level objects. in case it's graph class itself, not methods.

also need pass string 'testcase.txt' not testcase.txt.


Comments

Popular posts from this blog

git - Initial Commit: "fatal: could not create leading directories of ..." -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -