How to import module with number prefix


i have a file pages/ where have functions

def fn1():

def fn2():

def fn3(): want to import fn2 only

from pages.01_sample import f2

causes an error

SyntaxError: invalid decimal literal

if i rename to pages.sample only, the import works

how to import the module 01_sample ?


Afaik it is not allowed in python that an identifier starts with a digit.
You could rename your module to sample_01 which should work.


I’d revisit my naming conventions then.