Python Forum
Calling from many different files - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Calling from many different files (/thread-16097.html)



Calling from many different files - davy_yg - Feb-14-2019

I wonder if in python you can call function from many different files without having to reference it yourself?


for example:

bet.py
def hit(deck, hand)
	
	single_card = deck.deal()
	hand.add_card(single_card)
	hand.adjust_for_ace()
adjust_for_ace is from hand.py in sublime I can hover it and check where it comes from. Will this works automatically?


RE: Calling from many different files - ichabod801 - Feb-14-2019

No. You need import hand in bet.py for that to work.