0

For example: shutil is default python module

I have created custom python file called shutil.py and below is the code in that shutil.py file

import shutil
shutil.move('test.py', 'test/test.py')

It returned below error instead of calling python shutil module which was imported in this shutil.py file

AttributeError: 'module' object has no attribute 'move'

Please help me in this

Thanks

zwer
  • 24,943
  • 3
  • 48
  • 66
  • Possible duplicate of [Importing from builtin library when module with same name exists](https://stackoverflow.com/questions/6031584/importing-from-builtin-library-when-module-with-same-name-exists) – zwer Jul 12 '17 at 14:12

2 Answers2

0

I suggest you to rename the import with as keyword

Mikedev
  • 316
  • 1
  • 8
0

You need to move your line down like so:

import shutil 
shutil.move('test.py', 'test/test.py')
Jeffrey J
  • 53
  • 2
  • 8