How to import module with number prefix

hi,

i have a file pages/01_sample.py where 01_sample.py have functions

def fn1():

def fn2():

def fn3():

tasks.py 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 ?

TIA

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.

Thanks,

I’d revisit my naming conventions then.

Cheers!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.