Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
vikas pal
11,563 Pointshow to use other file methods
hello friends, i am making a program but get confused in some steps.i want to use other file functions which is inside a class.when i do player=rocket()[for ex] it says name error that rocket is not defined but it is defined in second file which i imported.please tell me what to do here
vikas pal
11,563 Pointsi made the function in the same file to check that it works but it not works it still says name error.ex.
1.def rockets(base_selected):
2. base=[(5,0),(5,1),(5,2),(5,3)]
3. rocket_test=random.randint(1,10)
4. rocket_base_select=0
5. if rocket_test>7:
6. rocket_base_select=random.choice(base)
7. if rocket_base_select in base_selected:
8. pass
9. else:
10. return rockets(base_selected)
11. return rocket_base_select
12.while True:
13. base(base_selected)
14. rocket_base_selected=rockets(base_selected)
15. map(player,cells,base_selected,rocket_base_selected)
16. rocket_base_selected=rockets(base_selected)
17. player,left_turn,right_turn,invisible,rocket=moved(player,left_turn,right_turn,invisible,rocket)
18. player=checker(player,base_selected)
19. base_selected,player=up(base_selected,player)
the return rockets(base_selected) in line 10
Vittorio Somaschini
33,371 PointsVittorio Somaschini
33,371 PointsHi Vikas can you please provide the involved code (or part of it) so that we can have a look at it?
ty